order_cloud 0.0.3 → 0.0.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: 250f74731c2d25ffcecea2f0abbe0ec24f5595a8
4
- data.tar.gz: 5a09a7e6c7c4923dd9260adb008d21331fb7e5b6
3
+ metadata.gz: 3fa92c234e765c40fcad785ad62bf60508189748
4
+ data.tar.gz: 4c092f862bea6d0b0ef10cd9a5d22b3ea5d1b837
5
5
  SHA512:
6
- metadata.gz: e4013ace0f650a42cc554889601b42ffbf16ca11898894866e76bb082a9ea776c66a292342302d2e6008f2a63dd2a0891a96e9c7ca9e63577806ab0f487028f5
7
- data.tar.gz: f999c9f19d5f8bff2e34951da562dcdb9732febebe3eba1a0389ac75e91c31a58713ef068b2b12c6869cf7d9aefc9eaf02d6256e8046c52350be9fdd1c1bc791
6
+ metadata.gz: 40caddc7f35545595a05af2cc0fca41d745c4cf281d4477a7d0abe6dcde0fc6d5202544376f5d5fce41a0180b1f54ea50d56c6760a6f4c315d96f41beea1ec10
7
+ data.tar.gz: 26670c5091e2c34f544295cf4ae2386f438d075dd5f60b1c7189e53d6a0994b0a24c4a6d06bde1b6c4956e6ef0f74e17689939a514738d66671686f3409eb7e3
data/Gemfile CHANGED
@@ -1,3 +1,26 @@
1
+ =begin
2
+ #OrderCloud
3
+
4
+ #A full ecommerce backend as a service.
5
+
6
+ OpenAPI spec version: 1.0
7
+ Contact: ordercloud@four51.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
1
24
  source 'https://rubygems.org'
2
25
 
3
26
  gem 'typhoeus'
data/README.md CHANGED
@@ -9,8 +9,8 @@ OrderCloud - the Ruby gem for the OrderCloud
9
9
  This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
10
10
 
11
11
  - API version: 1.0
12
- - Package version: 0.0.3
13
- - Build date: 2016-09-14T14:59:22.725-05:00
12
+ - Package version: 0.0.4
13
+ - Build date: 2016-09-27T14:37:05.237-05:00
14
14
  - Build package: class io.swagger.codegen.languages.RubyClientCodegen
15
15
 
16
16
  For more information, please visit [http://public.four51.com/](http://public.four51.com/)
@@ -22,7 +22,7 @@ For more information, please visit [http://public.four51.com/](http://public.fou
22
22
 
23
23
  Add this line to your `Gemfile`:
24
24
 
25
- gem 'order_cloud', '~> 0.0.3'
25
+ gem 'order_cloud', '~> 0.0.4'
26
26
 
27
27
  Or run this in your terminal:
28
28
  ```shell
@@ -57,10 +57,10 @@ user_instance = OrderCloud::UserApi.new
57
57
  impersonation_token = user_instance.get_access_token(buyer_id, user_id, { :claims => ['YOUR_CLAIM'] })
58
58
 
59
59
  OrderCloud::ApiAuth::start_impersonate(impersonation_token)
60
- puts 'Impersonation status: #{{{{moduleName}}}::Configuration.default.impersonation}'
60
+ puts 'Impersonation status: #{ OrderCloud::Configuration.default.impersonating?}'
61
61
 
62
62
  OrderCloud::ApiAuth::stop_impersonate
63
- puts 'Impersonation status: #{{{{moduleName}}}::Configuration.default.impersonation}'
63
+ puts 'Impersonation status: #{ OrderCloud::Configuration.default.impersonating?}'
64
64
  ```
65
65
 
66
66
  ## Example
@@ -33,7 +33,7 @@ if [ "$git_repo_id" = "" ]; then
33
33
  fi
34
34
 
35
35
  if [ "$release_note" = "" ]; then
36
- release_note="Bumped gem version to 0.0.3"
36
+ release_note="Minor update"
37
37
  echo "[INFO] No command line input provided. Set \$release_note to $release_note"
38
38
  fi
39
39
 
@@ -55,7 +55,16 @@ module OrderCloud
55
55
  )
56
56
  request.on_complete do |response|
57
57
  if response.success?
58
- OrderCloud::Configuration.default.access_token = JSON.parse(response.body)["access_token"]
58
+ token = JSON.parse(response.body)
59
+ if(token.key?("error"))
60
+ fail token["error"]
61
+ else
62
+ OrderCloud::Configuration.default.access_token = OrderCloud::AccessToken.new({
63
+ :access_token => token["access_token"],
64
+ :expires_in => token["expires_in"],
65
+ :token_type => token["token_type"]
66
+ })
67
+ end
59
68
  elsif response.timed_out?
60
69
  fail "HTTP Request timed out"
61
70
  elsif response.code == 0
@@ -93,7 +102,7 @@ module OrderCloud
93
102
  end
94
103
 
95
104
  def self.stop_impersonate
96
- OrderCloud::Configuration.default.impersonation_token = ''
105
+ OrderCloud::Configuration.default.impersonation_token = nil
97
106
  end
98
107
  end
99
108
  end
@@ -33,7 +33,7 @@ module OrderCloud
33
33
 
34
34
  # Returns true if impersonation is on, false otherwise
35
35
  def impersonating?
36
- !@impersonation_token.empty?
36
+ @impersonation_token
37
37
  end
38
38
 
39
39
  # Returns the appropriate token
@@ -171,7 +171,8 @@ module OrderCloud
171
171
  @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
172
172
 
173
173
  @auth_url = 'https://auth.ordercloud.io/oauth/token'
174
- @impersonation_token = ''
174
+ @impersonation_token = nil
175
+ @access_token = nil
175
176
  @client_id = ''
176
177
  @scopes = []
177
178
 
@@ -236,7 +237,7 @@ module OrderCloud
236
237
  type: 'oauth2',
237
238
  in: 'header',
238
239
  key: 'Authorization',
239
- value: "Bearer #{get_access_token}"
240
+ value: "Bearer #{get_access_token.access_token}"
240
241
  },
241
242
  }
242
243
  end
@@ -22,5 +22,5 @@ limitations under the License.
22
22
  =end
23
23
 
24
24
  module OrderCloud
25
- VERSION = "0.0.3"
25
+ VERSION = "0.0.4"
26
26
  end
@@ -37,7 +37,7 @@ describe OrderCloud::ApiAuth do
37
37
  let(:scopes) { ['FullAccess'] }
38
38
  let(:bad_auth_url) { 'thisshouldnotwork.com' }
39
39
 
40
- let(:impersonation_token) { '4QAtuGBvK8bj22XdT0H5' }
40
+ let(:impersonation_token) { OrderCloud::AccessToken.new({:access_token => '4QAtuGBvK8bj22XdT0H5', :expires_in => 1000, :token_type => 'Bearer' }) }
41
41
 
42
42
  let(:config) { OrderCloud::Configuration.default }
43
43
  before(:each) do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: order_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Le Cam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-14 00:00:00.000000000 Z
11
+ date: 2016-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -473,7 +473,6 @@ files:
473
473
  - lib/order_cloud/models/web_hook_route.rb
474
474
  - lib/order_cloud/models/xp_index.rb
475
475
  - lib/order_cloud/version.rb
476
- - order_cloud-0.0.2.gem
477
476
  - order_cloud.gemspec
478
477
  - spec/api/address_api_spec.rb
479
478
  - spec/api/admin_address_api_spec.rb
Binary file