order_cloud 0.0.1 → 0.0.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 +39 -42
- data/git_push.sh +3 -3
- data/lib/order_cloud/configuration.rb +4 -3
- data/lib/order_cloud/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c7b3cff6308e2c4d8b355429fbfcdd56af63576
|
4
|
+
data.tar.gz: 4df681e2b92eefaf7b11bf2519774202fa3a4cd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d41e97378ca05c568cae330af17fda3a390a3bdc707c61f9604ad547c2c848efcc47a0d60c9b508f63005decef33e9c2e5e49899cf676e84e84123e3b38dc0a7
|
7
|
+
data.tar.gz: 26e2cc1041aa410217308ddb65500469cca49ef5ba8b53e64683dee330fce822e85359a9aa9837d1a595c86d2e8979d51ab8930178150d8a11a7875056c737e4
|
data/README.md
CHANGED
@@ -1,81 +1,78 @@
|
|
1
1
|
# order_cloud
|
2
2
|
|
3
|
+
## Introduction
|
4
|
+
OrderCloud gem is an SDK for OrderCloud's API written in Ruby. All of the methods for the most part are a 1:1 reflection of the API. This guide will cover how to install and get started with OrderCloud Ruby gem.
|
3
5
|
OrderCloud - the Ruby gem for the OrderCloud
|
4
6
|
|
5
|
-
|
7
|
+
## Acknowledgment
|
6
8
|
|
7
9
|
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
8
10
|
|
9
11
|
- API version: 1.0
|
10
|
-
- Package version: 0.0.
|
11
|
-
- Build date: 2016-09-
|
12
|
+
- Package version: 0.0.2
|
13
|
+
- Build date: 2016-09-14T11:33:46.332-05:00
|
12
14
|
- Build package: class io.swagger.codegen.languages.RubyClientCodegen
|
15
|
+
|
13
16
|
For more information, please visit [http://public.four51.com/](http://public.four51.com/)
|
14
17
|
|
18
|
+
## Requirements
|
19
|
+
- Ruby >= 2.3.0
|
20
|
+
|
15
21
|
## Installation
|
16
22
|
|
17
|
-
|
23
|
+
Add this line to your `Gemfile`:
|
18
24
|
|
19
|
-
|
25
|
+
gem 'order_cloud', '~> 0.0.2'
|
20
26
|
|
27
|
+
Or run this in your terminal:
|
21
28
|
```shell
|
22
|
-
gem
|
29
|
+
gem install order_cloud
|
23
30
|
```
|
24
31
|
|
25
|
-
|
26
|
-
|
27
|
-
```shell
|
28
|
-
gem install ./order_cloud-0.0.1.gem
|
29
|
-
```
|
30
|
-
(for development, run `gem install --dev ./order_cloud-0.0.1.gem` to install the development dependencies)
|
31
|
-
|
32
|
-
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
33
|
-
|
34
|
-
Finally add this to the Gemfile:
|
35
|
-
|
36
|
-
gem 'order_cloud', '~> 0.0.1'
|
37
|
-
|
38
|
-
### Install from Git
|
39
|
-
|
40
|
-
If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
|
41
|
-
|
42
|
-
gem 'order_cloud', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
|
43
|
-
|
44
|
-
### Include the Ruby code directly
|
45
|
-
|
46
|
-
Include the Ruby code directly using `-I` as follows:
|
32
|
+
## Configuration
|
47
33
|
|
48
|
-
|
49
|
-
ruby -Ilib script.rb
|
50
|
-
```
|
34
|
+
You will need to provide the ClientID which identifies the Organization or Buyer Company you will be interacting with. The ClientID can be found in the application tab of your Dashboard. Check out this guide for more information. Once you have the ClientID you can configure it with the following function.
|
51
35
|
|
52
|
-
## Getting Started
|
53
|
-
|
54
|
-
Please follow the [installation](#installation) procedure and then run the following code:
|
55
36
|
```ruby
|
56
37
|
# Load the gem
|
57
38
|
require 'order_cloud'
|
58
39
|
|
59
40
|
# Setup authorization
|
60
41
|
OrderCloud.configure do |config|
|
61
|
-
|
62
|
-
config.
|
42
|
+
config.client_id = 'MY_CLIENT_ID'
|
43
|
+
config.scopes= ['MY_SCOPE']
|
63
44
|
end
|
45
|
+
```
|
64
46
|
|
65
|
-
|
47
|
+
## Authentication
|
66
48
|
|
67
|
-
|
49
|
+
```ruby
|
50
|
+
OrderCloud::ApiAuth::login('username', 'password')
|
51
|
+
```
|
68
52
|
|
69
|
-
|
53
|
+
## Impersonation
|
70
54
|
|
55
|
+
```ruby
|
56
|
+
user_instance = OrderCloud::UserApi.new
|
57
|
+
impersonation_token = user_instance.get_access_token(buyer_id, user_id, { :claims => ['YOUR_CLAIM'] })
|
58
|
+
|
59
|
+
OrderCloud::ApiAuth::start_impersonate(impersonation_token)
|
60
|
+
puts 'Impersonation status: #{{{{moduleName}}}::Configuration.default.impersonation}'
|
61
|
+
|
62
|
+
OrderCloud::ApiAuth::stop_impersonate
|
63
|
+
puts 'Impersonation status: #{{{{moduleName}}}::Configuration.default.impersonation}'
|
64
|
+
```
|
65
|
+
|
66
|
+
## Example
|
67
|
+
```ruby
|
68
|
+
api_instance = OrderCloud::ProductApi.new
|
71
69
|
|
72
70
|
begin
|
73
|
-
result = api_instance.
|
71
|
+
result = api_instance.list
|
74
72
|
p result
|
75
73
|
rescue OrderCloud::ApiError => e
|
76
|
-
puts "Exception when calling
|
74
|
+
puts "Exception when calling ProductApi->list: #{e}"
|
77
75
|
end
|
78
|
-
|
79
76
|
```
|
80
77
|
|
81
78
|
## Documentation for API Endpoints
|
data/git_push.sh
CHANGED
@@ -23,17 +23,17 @@ git_repo_id=$2
|
|
23
23
|
release_note=$3
|
24
24
|
|
25
25
|
if [ "$git_user_id" = "" ]; then
|
26
|
-
git_user_id="
|
26
|
+
git_user_id="ordercloud-api"
|
27
27
|
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
28
28
|
fi
|
29
29
|
|
30
30
|
if [ "$git_repo_id" = "" ]; then
|
31
|
-
git_repo_id="
|
31
|
+
git_repo_id="ordercloud-ruby-sdk"
|
32
32
|
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
33
33
|
fi
|
34
34
|
|
35
35
|
if [ "$release_note" = "" ]; then
|
36
|
-
release_note="
|
36
|
+
release_note="Added auth_url definition to configuration"
|
37
37
|
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
38
38
|
fi
|
39
39
|
|
@@ -35,8 +35,9 @@ module OrderCloud
|
|
35
35
|
def impersonating?
|
36
36
|
!@impersonation_token.empty?
|
37
37
|
end
|
38
|
+
u will need to provide the ClientID which identifies the Organization or Buyer Company you will be interacting with. The ClientID can be found in the application tab of your Dashboard. Check out this guide for more information. Once you have the ClientID you can configure it with the following function.
|
38
39
|
|
39
|
-
# Returns the appropriate token
|
40
|
+
# Returns the appropriate token
|
40
41
|
def get_access_token
|
41
42
|
if impersonating?
|
42
43
|
@impersonation_token
|
@@ -170,10 +171,10 @@ module OrderCloud
|
|
170
171
|
@force_ending_format = false
|
171
172
|
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
172
173
|
|
173
|
-
@auth_url
|
174
|
+
@auth_url = 'https://auth.ordercloud.io/oauth/token'
|
174
175
|
@impersonation_token = ''
|
175
176
|
@client_id = ''
|
176
|
-
@scopes = []
|
177
|
+
@scopes = []
|
177
178
|
|
178
179
|
yield(self) if block_given?
|
179
180
|
end
|
data/lib/order_cloud/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.2
|
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-
|
11
|
+
date: 2016-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -621,7 +621,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
621
621
|
version: '0'
|
622
622
|
requirements: []
|
623
623
|
rubyforge_project:
|
624
|
-
rubygems_version: 2.
|
624
|
+
rubygems_version: 2.5.1
|
625
625
|
signing_key:
|
626
626
|
specification_version: 4
|
627
627
|
summary: A Ruby Gem for the OrderCloud.io B2B eCommerce platform
|