lib/peddler/client.rb in peddler-0.7.11 vs lib/peddler/client.rb in peddler-0.8.0
- old
+ new
@@ -21,11 +21,11 @@
'A1VC38T7YXB528' => 'mws.amazonservices.jp',
'ATVPDKIKX0DER' => 'mws.amazonservices.com'
}
attr_accessor :path
- attr_writer :merchant_id, :marketplace_id
+ attr_writer :merchant_id, :marketplace_id, :parser
attr_reader :body
alias :configure :tap
params('SellerId' => -> { merchant_id })
@@ -52,10 +52,14 @@
def merchant_id
@merchant_id ||= ENV['MWS_MERCHANT_ID']
end
+ def parser
+ @parser ||= Parser
+ end
+
def headers
@headers ||= {}
end
def body=(str)
@@ -65,10 +69,10 @@
def operation(action = nil)
action ? @operation = Operation.new(action) : @operation
end
- def run(parser = Parser, &blk)
+ def run(&blk)
opts = { query: operation, headers: headers, expects: 200 }
opts.store(:body, body) if body
opts.store(:response_block, blk) if block_given?
res = post(opts)