Class: MoreappAPI::Customer
- Inherits:
-
Object
- Object
- MoreappAPI::Customer
- Defined in:
- lib/moreapp_api/customer.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#moreapp_api ⇒ Object
Returns the value of attribute moreapp_api.
-
#name ⇒ Object
Returns the value of attribute name.
-
#raw_data ⇒ Object
Returns the value of attribute raw_data.
Instance Method Summary collapse
- #folders ⇒ Object
-
#initialize(moreapp_api, data) ⇒ Customer
constructor
A new instance of Customer.
Constructor Details
#initialize(moreapp_api, data) ⇒ Customer
Returns a new instance of Customer.
8 9 10 11 12 13 14 |
# File 'lib/moreapp_api/customer.rb', line 8 def initialize(moreapp_api, data) @moreapp_api = moreapp_api @id = data["customerId"] @name = data["name"] @raw_data = data end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/moreapp_api/customer.rb', line 6 def id @id end |
#moreapp_api ⇒ Object
Returns the value of attribute moreapp_api.
6 7 8 |
# File 'lib/moreapp_api/customer.rb', line 6 def moreapp_api @moreapp_api end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/moreapp_api/customer.rb', line 6 def name @name end |
#raw_data ⇒ Object
Returns the value of attribute raw_data.
6 7 8 |
# File 'lib/moreapp_api/customer.rb', line 6 def raw_data @raw_data end |
Instance Method Details
#folders ⇒ Object
16 17 18 19 20 21 |
# File 'lib/moreapp_api/customer.rb', line 16 def folders response = @moreapp_api.request(:get, "/api/v1.0/customers/#{self.id}/folders") folders = JSON.parse(response.body) folders.map{|data| MoreappAPI::Folder.new(self, data)} end |