apple_reporter 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa91e538a8469cc35b2bc53534febcc12944b9af
4
- data.tar.gz: df6b6655e7a3876fd5ce675961c78dfa72f149a7
3
+ metadata.gz: f9609786844909fdf453e6429dc6ebe596eada77
4
+ data.tar.gz: cba7b3351e012f9d7f6c32723c888a0ca4919436
5
5
  SHA512:
6
- metadata.gz: '09568ebf9a69689919895cd4abb828174989418d7c2de0095ef9dc39c02c16b959a25efbfc7e04379ccacb74e367a4cf8412e3483655b543791379d8d59310e5'
7
- data.tar.gz: 43c0e8a9c184b1be2bf1429600855e9394b5f814e813b3d82fc64beeceb70bd30c7e11fcc8b638cce7eff056cc16c94c6f4a579912baacf648c6701af809739c
6
+ metadata.gz: 8d382919f316fe29ba521cb777d4d00a76d09df85f0168ed1ccd2e7304bab29ebe2755d15b028dd5d3d96f984c92c542c87b50065e53c9ab2a9986848e481b8e
7
+ data.tar.gz: b1d1692fedb41e54e7fe7409cdf1db676ac09d9d82f5175948d07e5e8cff1f6b14189d49779cf962d06b24eae614047062feb02ca6781fa3fb0565892a54470d
data/README.md CHANGED
@@ -28,33 +28,45 @@ Or install it yourself as:
28
28
 
29
29
  ### Sales
30
30
 
31
- - getReport
31
+ - get_report
32
32
 
33
33
  ```
34
34
  reporter = AppleReporter::Sale.new(user_id: 'your user id', access_token: 'your access token')
35
- report = reporter.getReport(
36
- {
37
- vendor_number: 'your vender id',
38
- report_type: 'Sales',
39
- report_sub_type: 'Summary',
40
- date_type: 'Daily',
41
- date: '20161212'
42
- }
35
+ report = reporter.get_report(
36
+ vendor_number: 'your vender id',
37
+ report_type: 'Sales',
38
+ report_sub_type: 'Summary',
39
+ date_type: 'Daily',
40
+ date: '20161212'
43
41
  )
44
42
  ```
45
43
  ### Finance
46
44
 
47
- - getReport
45
+ - get_report
48
46
  ```
49
47
  reporter = AppleReporter::Finance.new(user_id: 'your user id', access_token: 'your access token')
50
- report = reporter.getReport(
51
- {
52
- vendor_number: 'your vender id',
53
- region_code: 'US',
54
- report_type: 'Financial',
55
- fiscal_year: '2016',
56
- fiscal_period: '02'
57
- }
48
+ report = reporter.get_report(
49
+ vendor_number: 'your vender id',
50
+ region_code: 'US',
51
+ report_type: 'Financial',
52
+ fiscal_year: '2016',
53
+ fiscal_period: '02'
54
+ )
55
+ ```
56
+
57
+ - get_report with version
58
+ ```
59
+ reporter = AppleReporter::Finance.new(
60
+ user_id: 'your user id',
61
+ access_token: 'your access token'
62
+ version: '1_1'
63
+ )
64
+ report = reporter.get_report(
65
+ vendor_number: 'your vender id',
66
+ region_code: 'US',
67
+ report_type: 'Financial',
68
+ fiscal_year: '2016',
69
+ fiscal_period: '02'
58
70
  )
59
71
  ```
60
72
 
@@ -1,49 +1,46 @@
1
1
  module AppleReporter
2
2
  class Finance < Reporter
3
-
4
- # getAccounts
3
+ # accounts
5
4
  #
6
5
  # Usage:
7
- # report = reporter.getAccounts
8
- def getAccounts
6
+ # report = reporter.accounts
7
+ def accounts
9
8
  fetch(@config[:finance_path], 'Finance.getAccounts')
10
9
  end
11
10
 
12
- # getStatus
11
+ # status
13
12
  #
14
13
  # Usage:
15
- # report = reporter.getStatus
16
- def getStatus
14
+ # report = reporter.status
15
+ def status
17
16
  fetch(@config[:finance_path], 'Finance.getStatus')
18
17
  end
19
18
 
20
- # getVendorsAndRegions
19
+ # vendors_and_regions
21
20
  #
22
21
  # Usage:
23
- # report = reporter.getVendorsAndRegions
24
- def getVendorsAndRegions
22
+ # report = reporter.vendors_and_regions
23
+ def vendors_and_regions
25
24
  fetch(@config[:finance_path], 'Finance.getVendorsAndRegions')
26
25
  end
27
26
 
28
- # getReport
27
+ # get_report
29
28
  # Refer to: https://help.apple.com/itc/appsreporterguide/
30
29
  #
31
30
  # Usage:
32
31
  #
33
- # report = reporter.getReport(
34
- # {
35
- # vendor_number: 'myVendor',
36
- # region_code: 'US',
37
- # report_type: 'Financial',
38
- # fiscal_year: '2016',
39
- # fiscal_period: '02'
40
- # }
32
+ # report = reporter.get_report(
33
+ # vendor_number: 'myVendor',
34
+ # region_code: 'US',
35
+ # report_type: 'Financial',
36
+ # fiscal_year: '2016',
37
+ # fiscal_period: '02'
41
38
  # )
42
- def getReport(params = {})
39
+ def get_report(params = {})
43
40
  fetch(@config[:finance_path], (['Finance.getReport'] + [params.slice(:vendor_number, :region_code, :report_type, :fiscal_year, :fiscal_period).values.join(',')]).join(', '))
44
41
  end
45
42
 
46
- def getVersion
43
+ def version
47
44
  @config[:version]
48
45
  end
49
46
  end
@@ -11,7 +11,7 @@ module AppleReporter
11
11
  sales_path: '/sales/v1',
12
12
  finance_path: '/finance/v1',
13
13
  mode: 'Robot.XML',
14
- version: '1.0',
14
+ version: '1_0'
15
15
  }.merge(config)
16
16
  end
17
17
 
@@ -31,13 +31,13 @@ module AppleReporter
31
31
  payload[:account] = @config[:account] if @config[:account]
32
32
 
33
33
  response = RestClient.post("#{ENDPOINT}#{api_path}", "jsonRequest=#{payload.to_json}", headers)
34
- handleResponse(@config[:mode], response)
34
+ handle_response(@config[:mode], response)
35
35
  rescue RestClient::ExceptionWithResponse => err
36
- handleResponse(@config[:mode], err.response)
36
+ handle_response(@config[:mode], err.response)
37
37
  end
38
38
 
39
39
  #
40
- def handleResponse(mode, response)
40
+ def handle_response(mode, response)
41
41
  if response.code == 200
42
42
  if response.headers[:content_type] == 'application/a-gzip'
43
43
  io = StringIO.new(response.body)
@@ -1,51 +1,47 @@
1
1
  module AppleReporter
2
2
  class Sale < Reporter
3
-
4
- # getAccounts
3
+ # accounts
5
4
  #
6
5
  # Usage:
7
- # report = reporter.getAccounts
8
- def getAccounts
6
+ # report = reporter.accounts
7
+ def accounts
9
8
  fetch(@config[:sales_path], 'Sales.getAccounts')
10
9
  end
11
10
 
12
- # getStatus
11
+ # status
13
12
  #
14
13
  # Usage:
15
- # report = reporter.getStatus
16
- def getStatus
14
+ # report = reporter.status
15
+ def status
17
16
  fetch(@config[:sales_path], 'Sales.getStatus')
18
17
  end
19
18
 
20
- # getVendors
19
+ # vendors
21
20
  #
22
21
  # Usage:
23
- # report = reporter.getVendors
24
- def getVendors
22
+ # report = reporter.vendors
23
+ def vendors
25
24
  fetch(@config[:sales_path], 'Sales.getVendors')
26
25
  end
27
26
 
28
- def getVersion
27
+ def version
29
28
  @config[:version]
30
29
  end
31
30
 
32
- # getReport
31
+ # get_report
33
32
  # Refer to: https://help.apple.com/itc/appsreporterguide/
34
33
  #
35
34
  # Usage:
36
35
  #
37
- # report = reporter.getReport(
38
- # {
39
- # vendor_number: 'myVendor',
40
- # report_type: 'Sales',
41
- # report_sub_type: 'Summary',
42
- # date_type: 'Daily',
43
- # date: '20161212'
44
- # }
36
+ # report = reporter.get_report(
37
+ # vendor_number: 'myVendor',
38
+ # report_type: 'Sales',
39
+ # report_sub_type: 'Summary',
40
+ # date_type: 'Daily',
41
+ # date: '20161212'
45
42
  # )
46
- def getReport(params = {})
43
+ def get_report(params = {})
47
44
  fetch(@config[:sales_path], (['Sales.getReport'] + [params.slice(:vendor_number, :report_type, :report_sub_type, :date_type, :date).values.join(',')]).join(', '))
48
45
  end
49
-
50
46
  end
51
47
  end
@@ -1,3 +1,3 @@
1
1
  module AppleReporter
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apple_reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Lin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-20 00:00:00.000000000 Z
11
+ date: 2017-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client