Class: Feathr::Api::Membership

Inherits:
FeathrObject show all
Defined in:
lib/feathr/api/membership.rb

Instance Attribute Summary

Attributes inherited from FeathrObject

#data, #id

Attributes inherited from FeathrEndpoint

#client, #prepended_path

Instance Method Summary collapse

Methods inherited from FeathrObject

#as_json, #full_path, nested

Methods inherited from FeathrEndpoint

api_path, define_all, define_create, define_destroy, define_find, define_update, feathr_endpoints, feathr_object

Constructor Details

#initialize(data) ⇒ Membership

Returns a new instance of Membership.



7
8
9
# File 'lib/feathr/api/membership.rb', line 7

def initialize(data)
  @data = data
end

Instance Method Details

#pathObject



11
12
13
# File 'lib/feathr/api/membership.rb', line 11

def path
  api_path
end

#platformObject



20
21
22
23
# File 'lib/feathr/api/membership.rb', line 20

def platform
  id = data["platform"][/\/(\d*)\/$/, 1]
  Feathr::Api::Platforms.new.find(id)
end

#userObject



15
16
17
18
# File 'lib/feathr/api/membership.rb', line 15

def user
  id = data["user"][/\/(\d*)\/$/, 1]
  Feathr::Api::Users.new.find(id)
end