appfigures_accessor 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6d2afe6ffb1f3d4a818b218ea22c7afe33433c15
4
+ data.tar.gz: 53fa15ac906c84e7b78da3c3b8dbb3e7c0a839fa
5
+ SHA512:
6
+ metadata.gz: 227802fb004811225f6e7ad2866d219d75517e3825cd512276555c5d7b37bd2288ade3b6dabf4b19dc16f06c77802f470363f349c1c2ab8708fee951e0407525
7
+ data.tar.gz: 1219ed146dca2265abfa905b0d84b3866138d9529cae14df113f2f7eb42277fc192c3fea51e886e7d1a9671dd9bc1360875cbf1b2868e503424b727659f744e6
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in appfigures_accessor.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Shinsuke KUROKI
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,44 @@
1
+ # AppfiguresAccessor
2
+
3
+ Accesses appfigures.com through API(v2.0)
4
+ see also http://docs.appfigures.com/
5
+
6
+ Most accessors are not implemented yet. Please fork and add your needs ;)
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem 'appfigures_accessor'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install appfigures_accessor
21
+
22
+ ## Usage
23
+
24
+ In advance, you need to register API Client on https://appfigures.com/developers/keys
25
+
26
+ > a = AppfiguresAccessor::Accessor.new('example@example', 'PASSWORD', 'CLIENT_KEY')
27
+ > a.sales
28
+ => {"downloads"=>0,
29
+ "updates"=>0,
30
+ "returns"=>0,
31
+ "net_downloads"=>0,
32
+ "promos"=>0,
33
+ "revenue"=>"0.0",
34
+ "edu_downloads"=>0,
35
+ "gifts"=>0,
36
+ "gift_redemptions"=>0}
37
+
38
+ ## Contributing
39
+
40
+ 1. Fork it ( http://github.com/<my-github-username>/appfigures_accessor/fork )
41
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
42
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
43
+ 4. Push to the branch (`git push origin my-new-feature`)
44
+ 5. Create new Pull Request
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'appfigures_accessor/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "appfigures_accessor"
8
+ spec.version = AppfiguresAccessor::VERSION
9
+ spec.authors = ["Shinsuke KUROKI"]
10
+ spec.email = ["s-kuroki@aiming-inc.com"]
11
+ spec.summary = %q{Accesses appfigures.com through API}
12
+ spec.description = %q{see http://docs.appfigures.com/}
13
+ spec.homepage = "https://github.com/skuroki/appfigures_accessor"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "httparty"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.5"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "pry"
27
+ spec.add_development_dependency "vcr"
28
+ spec.add_development_dependency "webmock", "< 1.16"
29
+ end
@@ -0,0 +1,6 @@
1
+ require "appfigures_accessor/version"
2
+ require "appfigures_accessor/accessor"
3
+
4
+ module AppfiguresAccessor
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,27 @@
1
+ require 'httparty'
2
+
3
+ module AppfiguresAccessor
4
+ class Accessor
5
+ include HTTParty
6
+ base_uri 'https://api.appfigures.com/v2/'
7
+
8
+ def initialize(username, password, client_key)
9
+ @username = username
10
+ @password = password
11
+ @client_key = client_key
12
+ end
13
+
14
+ [
15
+ [:my_products, '/products/mine'],
16
+ [:sales, '/sales'],
17
+ [:sales_by_dates_and_products, '/sales/dates+products'],
18
+ ].each do |name, path|
19
+ define_method name do |query_params = {}|
20
+ self.class.get(path, {
21
+ basic_auth: {username: @username, password: @password},
22
+ query: {client_key: @client_key}.merge(query_params)
23
+ }).parsed_response
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ module AppfiguresAccessor
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe AppfiguresAccessor::Accessor do
4
+ let(:accessor) { AppfiguresAccessor::Accessor.new(
5
+ 'foo@example.com',
6
+ 'PASSWORD',
7
+ 'CLIENT_KEY') }
8
+
9
+ describe '#my_products' do
10
+ it 'returns my products' do
11
+ VCR.use_cassette('my_products') do
12
+ accessor.my_products['42']['id'].should eq 42
13
+ end
14
+ end
15
+ end
16
+
17
+ describe '#sales' do
18
+ it 'returns sales' do
19
+ VCR.use_cassette('sales') do
20
+ accessor.sales['downloads'].should be_instance_of Fixnum
21
+ end
22
+ end
23
+ end
24
+
25
+ describe '#sales_by_dates_and_products' do
26
+ it 'returns sales_by_dates_and_products' do
27
+ VCR.use_cassette('sales_by_dates_and_products') do
28
+ sales = accessor.sales_by_dates_and_products(start_date: '2014-01-01', end_date:'2014-01-03', products: '12345;67890')
29
+ sales['2014-01-01']['12345']['downloads'].should be_instance_of Fixnum
30
+ sales['2014-01-03']['67890']['downloads'].should be_instance_of Fixnum
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe AppfiguresAccessor do
4
+ it 'should have a version number' do
5
+ AppfiguresAccessor::VERSION.should_not be_nil
6
+ end
7
+ end
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://foo%40example.com:PASSWORD@api.appfigures.com/v2/products/mine?client_key=CLIENT_KEY
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Cache-Control:
16
+ - private
17
+ Transfer-Encoding:
18
+ - chunked
19
+ Content-Type:
20
+ - application/json; charset=utf-8
21
+ X-Request-Limit:
22
+ - '1000'
23
+ X-Request-Usage:
24
+ - '4'
25
+ X-Server-Id:
26
+ - '11'
27
+ Date:
28
+ - Sun, 16 Feb 2014 07:41:18 GMT
29
+ Set-Cookie:
30
+ - SRV=; Expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
31
+ body:
32
+ encoding: UTF-8
33
+ string: "{\r\n \"42\": {\r\n \"id\": 42,\r\n \"name\": \"Fob Finder Pro\",\r\n \"developer\": \"Consolidated Fob\",\r\n \"icon\": \"http://a4.mzstatic.com/us/r1000/030/Purple/75/f4/1a/mzl.fjpeofny.100x100-75.jpg\",\r\n \"vendor_identifier\": \"101010\",\r\n \"ref_no\": 101010,\r\n \"sku\": null,\r\n \"store_id\": 1,\r\n \"store\": \"apple\",\r\n \"release_date\": \"2008-11-15T05:00:00-05:00\",\r\n \"added_date\": \"2011-11-28T19:06:11-05:00\",\r\n \"updated_date\": \"2013-06-26T09:02:44-04:00\",\r\n \"version\": \"1.2\",\r\n \"source\": {\r\n \"external_account_id\": 32,\r\n \"added_timestamp\": \"2009-01-02T17:50:00\",\r\n \"active\": true,\r\n \"hidden\": false,\r\n \"type\": \"own\"\r\n },\r\n \"type\": \"unknown\",\r\n \"devices\": [\r\n \"Handheld\",\r\n \"Tablet\"\r\n ],\r\n \"children\": [],\r\n \"features\": [],\r\n \"parent_id\": null,\r\n \"price\": {\r\n \"currency\": \"USD\",\r\n \"price\": \"1.00\"\r\n }\r\n }\r\n}"
34
+ http_version:
35
+ recorded_at: Sun, 16 Feb 2014 07:41:25 GMT
36
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,39 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://foo%40example.com:PASSWORD@api.appfigures.com/v2/sales?client_key=CLIENT_KEY
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Cache-Control:
16
+ - private
17
+ Transfer-Encoding:
18
+ - chunked
19
+ Content-Type:
20
+ - application/json; charset=utf-8
21
+ X-Request-Limit:
22
+ - '1000'
23
+ X-Request-Usage:
24
+ - '5'
25
+ X-Server-Id:
26
+ - '10'
27
+ Date:
28
+ - Sun, 16 Feb 2014 07:41:36 GMT
29
+ Set-Cookie:
30
+ - SRV=; Expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
31
+ body:
32
+ encoding: UTF-8
33
+ string: "{\r\n \"downloads\": 0,\r\n \"updates\": 0,\r\n \"returns\":
34
+ 0,\r\n \"net_downloads\": 0,\r\n \"promos\": 0,\r\n \"revenue\":
35
+ \"0.0\",\r\n \"edu_downloads\": 0,\r\n \"gifts\": 0,\r\n \"gift_redemptions\":
36
+ 0\r\n}"
37
+ http_version:
38
+ recorded_at: Sun, 16 Feb 2014 07:41:37 GMT
39
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,63 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://foo%40example.com:PASSWORD@api.appfigures.com/v2/sales/dates+products?client_key=CLIENT_KEY&end_date=2014-01-03&products=12345%3B67890&start_date=2014-01-01
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Cache-Control:
16
+ - private
17
+ Transfer-Encoding:
18
+ - chunked
19
+ Content-Type:
20
+ - application/json; charset=utf-8
21
+ X-Request-Limit:
22
+ - '1000'
23
+ X-Request-Usage:
24
+ - '9'
25
+ X-Server-Id:
26
+ - '13'
27
+ Date:
28
+ - Sun, 16 Feb 2014 10:28:15 GMT
29
+ Set-Cookie:
30
+ - SRV=; Expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
31
+ body:
32
+ encoding: UTF-8
33
+ string: "{\r\n \"2014-01-01\": {\r\n \"12345\": {\r\n \"downloads\":
34
+ 0,\r\n \"updates\": 0,\r\n \"returns\": 0,\r\n \"net_downloads\":
35
+ 0,\r\n \"promos\": 0,\r\n \"revenue\": \"0.00\",\r\n \"edu_downloads\":
36
+ 0,\r\n \"gifts\": 0,\r\n \"gift_redemptions\": 0,\r\n \"product_id\":
37
+ 12345,\r\n \"date\": \"2014-01-01\"\r\n },\r\n \"67890\":
38
+ {\r\n \"downloads\": 0,\r\n \"updates\": 0,\r\n \"returns\":
39
+ 0,\r\n \"net_downloads\": 0,\r\n \"promos\": 0,\r\n \"revenue\":
40
+ \"0.00\",\r\n \"edu_downloads\": 0,\r\n \"gifts\": 0,\r\n \"gift_redemptions\":
41
+ 0,\r\n \"product_id\": 67890,\r\n \"date\": \"2014-01-01\"\r\n
42
+ \ }\r\n },\r\n \"2014-01-02\": {\r\n \"12345\": {\r\n \"downloads\":
43
+ 0,\r\n \"updates\": 0,\r\n \"returns\": 0,\r\n \"net_downloads\":
44
+ 0,\r\n \"promos\": 0,\r\n \"revenue\": \"0.00\",\r\n \"edu_downloads\":
45
+ 0,\r\n \"gifts\": 0,\r\n \"gift_redemptions\": 0,\r\n \"product_id\":
46
+ 12345,\r\n \"date\": \"2014-01-02\"\r\n },\r\n \"67890\":
47
+ {\r\n \"downloads\": 0,\r\n \"updates\": 0,\r\n \"returns\":
48
+ 0,\r\n \"net_downloads\": 0,\r\n \"promos\": 0,\r\n \"revenue\":
49
+ \"0.00\",\r\n \"edu_downloads\": 0,\r\n \"gifts\": 0,\r\n \"gift_redemptions\":
50
+ 0,\r\n \"product_id\": 67890,\r\n \"date\": \"2014-01-02\"\r\n
51
+ \ }\r\n },\r\n \"2014-01-03\": {\r\n \"12345\": {\r\n \"downloads\":
52
+ 0,\r\n \"updates\": 0,\r\n \"returns\": 0,\r\n \"net_downloads\":
53
+ 0,\r\n \"promos\": 0,\r\n \"revenue\": \"0.00\",\r\n \"edu_downloads\":
54
+ 0,\r\n \"gifts\": 0,\r\n \"gift_redemptions\": 0,\r\n \"product_id\":
55
+ 12345,\r\n \"date\": \"2014-01-03\"\r\n },\r\n \"67890\":
56
+ {\r\n \"downloads\": 0,\r\n \"updates\": 0,\r\n \"returns\":
57
+ 0,\r\n \"net_downloads\": 0,\r\n \"promos\": 0,\r\n \"revenue\":
58
+ \"0.00\",\r\n \"edu_downloads\": 0,\r\n \"gifts\": 0,\r\n \"gift_redemptions\":
59
+ 0,\r\n \"product_id\": 67890,\r\n \"date\": \"2014-01-03\"\r\n
60
+ \ }\r\n }\r\n}"
61
+ http_version:
62
+ recorded_at: Sun, 16 Feb 2014 10:28:22 GMT
63
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,9 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'appfigures_accessor'
3
+
4
+ require 'vcr'
5
+ VCR.configure do |c|
6
+ c.allow_http_connections_when_no_cassette = true
7
+ c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
8
+ c.hook_into :webmock
9
+ end
metadata ADDED
@@ -0,0 +1,165 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: appfigures_accessor
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Shinsuke KUROKI
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: vcr
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "<"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.16'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "<"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.16'
111
+ description: see http://docs.appfigures.com/
112
+ email:
113
+ - s-kuroki@aiming-inc.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".rspec"
120
+ - ".travis.yml"
121
+ - Gemfile
122
+ - LICENSE.txt
123
+ - README.md
124
+ - Rakefile
125
+ - appfigures_accessor.gemspec
126
+ - lib/appfigures_accessor.rb
127
+ - lib/appfigures_accessor/accessor.rb
128
+ - lib/appfigures_accessor/version.rb
129
+ - spec/appfigures_accessor/accessor_spec.rb
130
+ - spec/appfigures_accessor_spec.rb
131
+ - spec/fixtures/vcr_cassettes/my_products.yml
132
+ - spec/fixtures/vcr_cassettes/sales.yml
133
+ - spec/fixtures/vcr_cassettes/sales_by_dates_and_products.yml
134
+ - spec/spec_helper.rb
135
+ homepage: https://github.com/skuroki/appfigures_accessor
136
+ licenses:
137
+ - MIT
138
+ metadata: {}
139
+ post_install_message:
140
+ rdoc_options: []
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ required_rubygems_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ requirements: []
154
+ rubyforge_project:
155
+ rubygems_version: 2.2.0
156
+ signing_key:
157
+ specification_version: 4
158
+ summary: Accesses appfigures.com through API
159
+ test_files:
160
+ - spec/appfigures_accessor/accessor_spec.rb
161
+ - spec/appfigures_accessor_spec.rb
162
+ - spec/fixtures/vcr_cassettes/my_products.yml
163
+ - spec/fixtures/vcr_cassettes/sales.yml
164
+ - spec/fixtures/vcr_cassettes/sales_by_dates_and_products.yml
165
+ - spec/spec_helper.rb