class Promisepay::Company

Manage Companies

Public Instance Methods

address() click to toggle source

Gets company address.

@see reference.promisepay.com/#addresses

@return [Hash]

# File lib/promisepay/models/company.rb, line 32
def address
  return nil unless @attributes.key?('related')
  response = JSON.parse(@client.get("addresses/#{send(:related)['addresses']}").body)
  response['addresses']
end
update(attributes) click to toggle source

Update the attributes of an item.

@see reference.promisepay.com/#update-item

@param attributes [Hash] Item's attributes to be updated.

@return [self]

# File lib/promisepay/models/company.rb, line 11
def update(attributes)
  response = JSON.parse(@client.patch("companies/#{send(:id)}", attributes).body)
  @attributes = response['companies']
  self
end
user() click to toggle source

Get the user the company belongs to.

@see

@return [Promisepay::User]

# File lib/promisepay/models/company.rb, line 22
def user
  response = JSON.parse(@client.get("companies/#{send(:id)}/users").body)
  Promisepay::User.new(@client, response['users'])
end