Skip to content

Commit

Permalink
rename User to Userobject to avid conflicts when used on a project
Browse files Browse the repository at this point in the history
  • Loading branch information
lopesrb committed Jul 8, 2022
1 parent 174ac37 commit fa6a70d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/learn_worlds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module LearnWorlds
autoload :Collection, "learn_worlds/collection"
autoload :Configuration, "learn_worlds/configuration"

autoload :User, "learn_worlds/objects/user"
autoload :UserObject, "learn_worlds/objects/user_object"

autoload :Resource, "learn_worlds/resource"
autoload :UserResource, "learn_worlds/resources/user_resource"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module LearnWorlds
class User < Object
class UserObject < Object
end
end
6 changes: 3 additions & 3 deletions lib/learn_worlds/resources/user_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ class UserResource < Resource

def list(**params)
response = get_request(ENDPOINT, params)
Collection.from_response(response, key: "data", type: User)
Collection.from_response(response, key: "data", type: UserObject)
end

def create(**attributes)
User.new(post_request(ENDPOINT, attributes).body)
UserObject.new(post_request(ENDPOINT, attributes).body)
end

def find(user_id:)
User.new(get_request("#{ENDPOINT}/#{user_id}").body)
UserObject.new(get_request("#{ENDPOINT}/#{user_id}").body)
end

def update(user_id:, **params)
Expand Down

0 comments on commit fa6a70d

Please sign in to comment.