Class: Giftrocket::Organization
- Inherits:
-
Object
- Object
- Giftrocket::Organization
- Defined in:
- lib/giftrocket/organization.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#website ⇒ Object
Returns the value of attribute website.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Organization
constructor
A new instance of Organization.
Constructor Details
#initialize(attributes) ⇒ Organization
Returns a new instance of Organization.
6 7 8 9 10 11 12 13 14 |
# File 'lib/giftrocket/organization.rb', line 6 def initialize(attributes) attributes = attributes.with_indifferent_access self.id = attributes[:id] self.name = attributes[:name] self.website = attributes[:website] self.phone = attributes[:phone] self.config = attributes[:config] self.created_at = attributes[:created_at] end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
4 5 6 |
# File 'lib/giftrocket/organization.rb', line 4 def config @config end |
#created_at ⇒ Object
Returns the value of attribute created_at.
4 5 6 |
# File 'lib/giftrocket/organization.rb', line 4 def created_at @created_at end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/giftrocket/organization.rb', line 4 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/giftrocket/organization.rb', line 4 def name @name end |
#phone ⇒ Object
Returns the value of attribute phone.
4 5 6 |
# File 'lib/giftrocket/organization.rb', line 4 def phone @phone end |
#website ⇒ Object
Returns the value of attribute website.
4 5 6 |
# File 'lib/giftrocket/organization.rb', line 4 def website @website end |
Class Method Details
.create!(data) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/giftrocket/organization.rb', line 16 def self.create!(data) response = Giftrocket::Request.post( 'organizations', body: data.merge(Giftrocket.).to_json, headers: { 'Content-Type' => 'application/json' } ) Giftrocket::Organization.new(response[:organization]) end |
.list ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/giftrocket/organization.rb', line 26 def self.list Giftrocket::Request.get( 'organizations', query: Giftrocket., format: 'json' )[:organizations].map do |org| Giftrocket::Organization.new(org) end end |