balihoo_lpc_client 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -1
- data/lib/balihoo_lpc_client/api.rb +11 -2
- data/lib/balihoo_lpc_client/request/authentication.rb +1 -1
- data/lib/balihoo_lpc_client/version.rb +1 -1
- data/lib/balihoo_lpc_client.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a419f5a1be223fef3953c4d503c46ca1efc38f7e
|
4
|
+
data.tar.gz: 0b8cdec43c0f6c5548824557760e3d4f0b212c54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 645048672a5b8baa72902b266866787ffe6db5822b478680d3563af2b924fb235426dac7f7bf3933ada5a5df7d36ad9130b6f3f1fcd1cdc1a791b518cd44d8e2
|
7
|
+
data.tar.gz: de75e508e3f92fd324d9625f16552aee8c73de5b92a3cf5dc98ccd2f78d7293957a6accc3e71d9db91d0e73bc833fe72cc662c33a06ad41cfda2e554824d34b3
|
data/README.md
CHANGED
@@ -40,8 +40,17 @@ opts = {
|
|
40
40
|
location_key: 'location_key', # optional more below
|
41
41
|
user_id: 'brand_key', # currently not used, Balihoo suggests setting same as brand_key
|
42
42
|
group_id: 'brand_key' # currently not used, Balihoo suggests setting same as brand_key
|
43
|
+
api_base: 'http://baseurl' # defaults to https://bac.dev.balihoo-cloud.com
|
44
|
+
api_version: 'v1.0' # defaults to v1.0
|
43
45
|
}
|
44
46
|
config = BalihooLpcClient::Configuration.create(opts)
|
47
|
+
|
48
|
+
# Blocks are also supported with the create method
|
49
|
+
|
50
|
+
config = BalihooLpcClient::Configuration.create(some_opts) do |c|
|
51
|
+
c.api_base = 'https://bac.dev.balihoo-cloud.com'
|
52
|
+
...
|
53
|
+
end
|
45
54
|
```
|
46
55
|
|
47
56
|
The `location_key` is an optional parameter. When not given the api will require
|
@@ -59,7 +68,9 @@ api.authenticate!
|
|
59
68
|
```
|
60
69
|
|
61
70
|
The `authenticate!` method will call out to Balihoo and set the `client_id` and
|
62
|
-
`client_api_key` on the config object for you.
|
71
|
+
`client_api_key` on the config object for you. **If an endpoint method is called
|
72
|
+
without calling `authenticate!` first a `BalihooLpcClient::NotAuthenticatedError`
|
73
|
+
will be raised.**
|
63
74
|
|
64
75
|
```ruby
|
65
76
|
config.client_id # => <client_id from Balihoo>
|
@@ -34,15 +34,24 @@ module BalihooLpcClient
|
|
34
34
|
private
|
35
35
|
|
36
36
|
def validate_params_and_fetch!(**args)
|
37
|
-
locations
|
37
|
+
validate_locations_key locations: args[:params][:locations]
|
38
|
+
authenticated?
|
38
39
|
|
40
|
+
fetch(**args)
|
41
|
+
end
|
42
|
+
|
43
|
+
def validate_locations_key(locations:)
|
39
44
|
if config.location_key.nil? && locations.nil?
|
40
45
|
raise ApiOptionError, 'must give params[:locations] since no location_key given'
|
41
46
|
elsif config.location_key.nil? && !locations.is_a?(Array)
|
42
47
|
raise ApiOptionError, 'locations must be an array'
|
43
48
|
end
|
49
|
+
end
|
44
50
|
|
45
|
-
|
51
|
+
def authenticated?
|
52
|
+
if config.client_id.nil? || config.client_api_key.nil?
|
53
|
+
raise NotAuthenticatedError, 'must call authenticate! before any endpoint'
|
54
|
+
end
|
46
55
|
end
|
47
56
|
|
48
57
|
def fetch(**args)
|
data/lib/balihoo_lpc_client.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: balihoo_lpc_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JD Guzman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-03-
|
12
|
+
date: 2016-03-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|