Class: RubyEcommClient::Client

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/ruby-ecomm-client/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

included

Constructor Details

#initialize(shopper_id, resource_type, resource_id) ⇒ Client

Returns a new instance of Client.

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
14
15
# File 'lib/ruby-ecomm-client/client.rb', line 7

def initialize(shopper_id, resource_type, resource_id)
  raise ArgumentError.new('shopper_id must be specified') if blank?(shopper_id)
  raise ArgumentError.new('resource_type must be specified') if blank?(resource_type)
  raise ArgumentError.new('resource_id must be specified') if blank?(resource_id)

  @shopper_id = shopper_id
  @resource_type = resource_type
  @resource_id = resource_id
end

Instance Attribute Details

#resource_idObject

Returns the value of attribute resource_id.



5
6
7
# File 'lib/ruby-ecomm-client/client.rb', line 5

def resource_id
  @resource_id
end

#resource_typeObject

Returns the value of attribute resource_type.



5
6
7
# File 'lib/ruby-ecomm-client/client.rb', line 5

def resource_type
  @resource_type
end

#shopper_idObject

Returns the value of attribute shopper_id.



5
6
7
# File 'lib/ruby-ecomm-client/client.rb', line 5

def shopper_id
  @shopper_id
end

Instance Method Details

#account_info(source_tree_id = 0) ⇒ Object



21
22
23
# File 'lib/ruby-ecomm-client/client.rb', line 21

def (source_tree_id = 0)
  service_manager.(source_tree_id)
end

#express_checkout?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/ruby-ecomm-client/client.rb', line 17

def express_checkout?
  service_profile.express_checkout?
end

#find_transition(transitions, target_pfid) ⇒ Object



29
30
31
# File 'lib/ruby-ecomm-client/client.rb', line 29

def find_transition(transitions, target_pfid)
  service_manager.find_transition(transitions, target_pfid)
end

#request_change(target_tree_id, client_ip = '127.0.0.1') ⇒ Object



41
42
43
# File 'lib/ruby-ecomm-client/client.rb', line 41

def request_change(target_tree_id, client_ip = '127.0.0.1')
  service_purchase.request_change(target_tree_id, client_ip)
end

#request_change_via_express(target_tree_id, client_ip = '127.0.0.1') ⇒ Object



37
38
39
# File 'lib/ruby-ecomm-client/client.rb', line 37

def request_change_via_express(target_tree_id, client_ip = '127.0.0.1')
  service_purchase.request_change_via_express(target_tree_id, client_ip)
end

#request_change_via_manager(target_tree_id) ⇒ Object



33
34
35
# File 'lib/ruby-ecomm-client/client.rb', line 33

def request_change_via_manager(target_tree_id)
  service_manager.request_change_via_manager(target_tree_id)
end

#transitions(source_tree_id = 0) ⇒ Object



25
26
27
# File 'lib/ruby-ecomm-client/client.rb', line 25

def transitions(source_tree_id = 0)
  service_manager.transitions(source_tree_id)
end