class Giftrocket::Organization

Attributes

config[RW]
created_at[RW]
id[RW]
name[RW]
phone[RW]
website[RW]

Public Class Methods

create!(data) click to toggle source
# File lib/giftrocket/organization.rb, line 16
def self.create!(data)
  response = Giftrocket::Request.post(
    'organizations',
    body: data.merge(Giftrocket.default_options).to_json,
    headers: { 'Content-Type' => 'application/json' }
  )

  Giftrocket::Organization.new(response[:organization])
end
list() click to toggle source
# File lib/giftrocket/organization.rb, line 26
def self.list
  Giftrocket::Request.get(
    'organizations',
    query: Giftrocket.default_options,
    format: 'json'
  )[:organizations].map do |org|
    Giftrocket::Organization.new(org)
  end
end
new(attributes) click to toggle source
# 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