Class: PlatformLib::AccountService

Inherits:
Object
  • Object
show all
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").

# direct instantiation
service = PlatformLib::AccountService.new("auth_token")

Constant Summary collapse

END_POINT =
"https://mps.theplatform.com/data/Account"

Instance Method Summary collapse

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 = .(range: "1-10")

.(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 (params = {}, &block)
  if block.nil?
    get_entries(END_POINT, params)      
  else
    get_entries(END_POINT, params, &block)
  end
end