Class: AmazonAssociateReport::Fetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/amazon_associate_report/fetch.rb

Defined Under Namespace

Classes: UnknownTrackingId

Constant Summary collapse

LOGIN_URL =
'https://affiliate.amazon.co.jp/gp/associates/login/login.html'
TOP_URL =
'https://affiliate.amazon.co.jp/gp/associates/network/reports/main.html'
BLACK_CURT =
"BLACK-CURT"
@@logger =
Logger.new(nil)

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(email, password) ⇒ Fetcher

Returns a new instance of Fetcher.



24
25
26
27
28
29
# File 'lib/amazon_associate_report/fetch.rb', line 24

def initialize(email, password)
  @agent = Mechanize.new{ |agent|
    agent.user_agent_alias = 'Windows IE 7'
  }
  (email, password)
end

Class Method Details

.logger=(logger) ⇒ Object



20
21
22
# File 'lib/amazon_associate_report/fetch.rb', line 20

def self.logger=(logger)
  @@logger = logger
end

Instance Method Details

#fetch_orders_xml(tracking_code, from, to) ⇒ Object



37
38
39
# File 'lib/amazon_associate_report/fetch.rb', line 37

def fetch_orders_xml(tracking_code, from, to)
  fetch_xml(tracking_code, from, to, :report_type => 'ordersReport')
end

#fetch_sales_xml(tracking_code, from, to) ⇒ Object



41
42
43
# File 'lib/amazon_associate_report/fetch.rb', line 41

def fetch_sales_xml(tracking_code, from, to)
  fetch_xml(tracking_code, from, to, :report_type => 'salesReport')
end

#fetch_xml(tracking_code, from, to, options = {}) ⇒ Object



31
32
33
34
35
# File 'lib/amazon_associate_report/fetch.rb', line 31

def fetch_xml(tracking_code, from, to, options={})
  go_top
  choose_tracking(tracking_code)
  report(from, to, options)
end