cantook 0.0.7 → 0.0.8
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 +6 -0
- 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: 8d16980052d06739dc662fed100a80edec647240
|
4
|
+
data.tar.gz: 21dbc29d2e39ebedeb215d981afd3b05adffcb66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cceaa2e604de1d9d11b77eb55b60d32ee61c95754cbd774367a717212b7a8fde31c176b099355d0c38716923f27acd9137b0a2229ddef0fd8e6cf57c534f58bc
|
7
|
+
data.tar.gz: 8163fde9ea70d8e944fb5a11ce6eebe1b30121bcf22e8d312fa9e8553c156c003d4e4a6568793bd005843f89f042829ff14c9fe918175efe30656fd3a722a590
|
data/lib/cantook/base.rb
CHANGED
@@ -12,6 +12,8 @@ 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
|
15
17
|
|
16
18
|
attr_accessor :base_url,
|
17
19
|
:auth,
|
@@ -36,6 +38,7 @@ module Cantook
|
|
36
38
|
# @option params [String] :format - format of the publication being sold, eg 'epub' or 'mobi'
|
37
39
|
# @option params [String] :sale_state - use 'test' for test/development, nil for production (real sales)
|
38
40
|
# @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.
|
39
42
|
def initialize(params = {})
|
40
43
|
@username = params[:username]
|
41
44
|
@password = params[:password]
|
@@ -52,13 +55,16 @@ module Cantook
|
|
52
55
|
|
53
56
|
# @return [Hash] A basic hash of options common to all Cantook requests
|
54
57
|
def base_options
|
58
|
+
Rails.logger.info "COUNTRY: #{country}, SELF COUNTRY #{self.country}"
|
55
59
|
{ format: format, isbn: isbn, sale_state: sale_state, currency: currency, country: country }
|
56
60
|
end
|
57
61
|
private :base_options
|
58
62
|
|
59
63
|
# @param [Hash] options
|
60
64
|
def get_request options
|
65
|
+
Rails.logger.info "BASE OPTIONS: #{base_options.inspect}"
|
61
66
|
self.query = options.merge(base_options)
|
67
|
+
Rails.logger.info "self query: #{self.query.inspect}"
|
62
68
|
HTTParty.get(request_url, query: query, basic_auth: auth)
|
63
69
|
end
|
64
70
|
private :get_request
|
data/lib/cantook/version.rb
CHANGED