cantook 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cantook/base.rb +2 -10
- data/lib/cantook/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b56ec6bfc9b513e4e50ffd669412d52c617e310
|
4
|
+
data.tar.gz: e51669f40a922c9c9792572423f4062a0aa61c17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9972e55cc9b39f26813e87629ef5dd3e792bd6648fe3ac35816a5a54d4812c905dac4d81fb7f59586f9e9395c0d9022eaa1a61e9989c5bb9887cabc996e381fb
|
7
|
+
data.tar.gz: 306c8a7be338bfe0d5250b23bd8db28d9c93d70d73f0e87ce14de482e0eee6481d61261ad844b6efc93aaf83b3d53b5262d71d88436156185d7709d8735d01e8
|
data/lib/cantook/base.rb
CHANGED
@@ -12,8 +12,6 @@ module Cantook
|
|
12
12
|
# organisation_id Yes Your merchant number. This number is provided upon registration.
|
13
13
|
# isbn Yes The publication's ISBN.
|
14
14
|
# format Yes The publication's format (pdf/epub/mobi).
|
15
|
-
# currency Yes
|
16
|
-
# country Yes
|
17
15
|
|
18
16
|
attr_accessor :base_url,
|
19
17
|
:auth,
|
@@ -26,8 +24,7 @@ module Cantook
|
|
26
24
|
:response,
|
27
25
|
:query,
|
28
26
|
:sale_state,
|
29
|
-
:currency
|
30
|
-
:country
|
27
|
+
:currency
|
31
28
|
|
32
29
|
# @param [Hash] params
|
33
30
|
# @option params [String] :username - your Cantook API username
|
@@ -38,7 +35,6 @@ module Cantook
|
|
38
35
|
# @option params [String] :format - format of the publication being sold, eg 'epub' or 'mobi'
|
39
36
|
# @option params [String] :sale_state - use 'test' for test/development, nil for production (real sales)
|
40
37
|
# @option params [String] :currency - 3-letter ISO-4217 code
|
41
|
-
# @option params [String] :counrtry - ISO 3166-1 Alpha-3 (can, fra, ita) or Alpha-2 (CA, FR, IT) formats.
|
42
38
|
def initialize(params = {})
|
43
39
|
@username = params[:username]
|
44
40
|
@password = params[:password]
|
@@ -48,23 +44,19 @@ module Cantook
|
|
48
44
|
@format = params[:format]
|
49
45
|
@sale_state = params[:sale_state]
|
50
46
|
@currency = params[:currency]
|
51
|
-
@country = params[:country]
|
52
47
|
@base_url = "https://#{platform}/api/organisations/#{organisation_id}"
|
53
48
|
@auth = { username: username, password: password }
|
54
49
|
end
|
55
50
|
|
56
51
|
# @return [Hash] A basic hash of options common to all Cantook requests
|
57
52
|
def base_options
|
58
|
-
|
59
|
-
{ format: format, isbn: isbn, sale_state: sale_state, currency: currency, country: country }
|
53
|
+
{ format: format, isbn: isbn, sale_state: sale_state, currency: currency}
|
60
54
|
end
|
61
55
|
private :base_options
|
62
56
|
|
63
57
|
# @param [Hash] options
|
64
58
|
def get_request options
|
65
|
-
Rails.logger.info "BASE OPTIONS: #{base_options.inspect}"
|
66
59
|
self.query = options.merge(base_options)
|
67
|
-
Rails.logger.info "self query: #{self.query.inspect}"
|
68
60
|
HTTParty.get(request_url, query: query, basic_auth: auth)
|
69
61
|
end
|
70
62
|
private :get_request
|
data/lib/cantook/version.rb
CHANGED