Class: Xdelivery::Client
- Inherits:
-
Object
- Object
- Xdelivery::Client
- Defined in:
- lib/xdelivery/client.rb,
lib/xdelivery/exceptions.rb
Defined Under Namespace
Classes: UnknownResponse
Constant Summary collapse
- EXPECTED_STATUSES =
{ 200 => 'Ok' , 401 => 'Unauthorized' }
- EXCEPTION_STATUSES =
{ 404 => 'Not Found', 500 => 'Internal Server Error', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', }
Instance Attribute Summary collapse
-
#access_key ⇒ Object
Returns the value of attribute access_key.
-
#merchant_no ⇒ Object
Returns the value of attribute merchant_no.
Instance Method Summary collapse
- #create_orders! {|api| ... } ⇒ Object
- #create_sales! {|api| ... } ⇒ Object
- #get_shops! ⇒ Object
-
#initialize(merchant_no, access_key) ⇒ Client
constructor
A new instance of Client.
- #ping! ⇒ Object
- #update_products! {|api| ... } ⇒ Object
Constructor Details
#initialize(merchant_no, access_key) ⇒ Client
Returns a new instance of Client.
6 7 8 9 |
# File 'lib/xdelivery/client.rb', line 6 def initialize(merchant_no, access_key) self.merchant_no = merchant_no self.access_key = access_key end |
Instance Attribute Details
#access_key ⇒ Object
Returns the value of attribute access_key.
4 5 6 |
# File 'lib/xdelivery/client.rb', line 4 def access_key @access_key end |
#merchant_no ⇒ Object
Returns the value of attribute merchant_no.
4 5 6 |
# File 'lib/xdelivery/client.rb', line 4 def merchant_no @merchant_no end |
Instance Method Details
#create_orders! {|api| ... } ⇒ Object
11 12 13 14 15 |
# File 'lib/xdelivery/client.rb', line 11 def create_orders! api = API::Orders.new(merchant_no, access_key) yield(api) api.create! end |
#create_sales! {|api| ... } ⇒ Object
17 18 19 20 21 |
# File 'lib/xdelivery/client.rb', line 17 def create_sales! api = API::Sales.new(merchant_no, access_key) yield(api) api.create! end |
#get_shops! ⇒ Object
29 30 31 |
# File 'lib/xdelivery/client.rb', line 29 def get_shops! API::Shops.new(merchant_no, access_key).get! end |