Class: PlatformLib::AccountService
- Inherits:
-
Object
- Object
- PlatformLib::AccountService
- Includes:
- ServiceBase
- Defined in:
- lib/platform_lib/account_service.rb
Overview
Public: A wrapper around the Account Data Service
Examples:
# the preferred method
service = PlatformLib::DataService.new("user", "pass").account_service
# direct instantiation
service = PlatformLib::AccountService.new("auth_token")
Constant Summary collapse
- END_POINT =
"https://mps.theplatform.com/data/Account"
Instance Method Summary collapse
-
#get_account_items(params = {}, &block) ⇒ Object
Public: Queries the account end point.
-
#initialize(auth_token) ⇒ AccountService
constructor
Public: Creates a new instance.
Constructor Details
#initialize(auth_token) ⇒ AccountService
Public: Creates a new instance
auth_token - the authentication token to be used
24 25 26 |
# File 'lib/platform_lib/account_service.rb', line 24 def initialize(auth_token) @auth_token = auth_token end |
Instance Method Details
#get_account_items(params = {}, &block) ⇒ Object
Public: Queries the account end point
params - an optional hash of parameters (query string) block - an optional block to be called for each item returned
Examples:
items = account_service.get_account_items(range: "1-10")
account_service.get_account_items(byCustomValue: "{test}{val}") do |item|
puts item.title
end
Returns the items supplied from the service
42 43 44 45 46 47 48 |
# File 'lib/platform_lib/account_service.rb', line 42 def get_account_items(params = {}, &block) if block.nil? get_entries(END_POINT, params) else get_entries(END_POINT, params, &block) end end |