Class: RIQ::AccountProperties
- Inherits:
-
Object
- Object
- RIQ::AccountProperties
- 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
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #field(id) ⇒ Object
-
#initialize ⇒ AccountProperties
constructor
Performs a network call and fetches the account properties for the org.
-
#node ⇒ String
Endpoint.
Constructor Details
#initialize ⇒ AccountProperties
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
#data ⇒ Object (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
25 26 27 |
# File 'lib/riq/account_properties.rb', line 25 def field(id) @data.select{|f| f[:id] == id.to_s}.first end |
#node ⇒ String
Returns endpoint.
20 21 22 |
# File 'lib/riq/account_properties.rb', line 20 def node 'accounts/fields' end |