Class: RIQ::AccountProperties

Inherits:
Object
  • Object
show all
Defined in:
lib/riq/account_properties.rb

Overview

Simple object for retrieving your org-wide account properties. The object is read only and provides only fetch and convenience methods.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAccountProperties

Performs a network call and fetches the account properties for the org.



9
10
11
12
13
14
15
16
17
# File 'lib/riq/account_properties.rb', line 9

def initialize
  @client = RIQ.client
  d = @client.get(node).symbolize
  if d
    @data = d[:fields]
  else
    raise RIQError, 'No account properties found'
  end
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



6
7
8
# File 'lib/riq/account_properties.rb', line 6

def data
  @data
end

Instance Method Details

#field(id) ⇒ Object

Parameters:

  • id (String, Int)

    A simple lookup for a field that has a matching ID



25
26
27
# File 'lib/riq/account_properties.rb', line 25

def field(id)
  @data.select{|f| f[:id] == id.to_s}.first
end

#nodeString

Returns endpoint.

Returns:

  • (String)

    endpoint



20
21
22
# File 'lib/riq/account_properties.rb', line 20

def node
  'accounts/fields'
end