chord 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +4 -10
- data/bin/console +1 -4
- data/lib/chord/version.rb +1 -1
- data/lib/chord.rb +28 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b19cd9b9520300cd180df422f8ec819593113febc7a63cfedb23c1b727e83a24
|
4
|
+
data.tar.gz: 4d654b32483b583e853a624b3b8d6e955b2647cd962222c8dd4be13498c464e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ecca2abcf3397c438bd15ff7fbf286ec2d867742cdfccb0b374cba05725db58fc59ce14da8fee4e7c1cb7347a48558ae7b79e9f30784ce352d261ea72a12576
|
7
|
+
data.tar.gz: 41bb0c8b107cb4ef7bc1fbbd930061097252d5ae5d2eb423935dc9c4c79d15ed1e4805f091d2ad64794ffa2f5282da084e1eeedc078d2446feff7dbc62e61553
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,16 +2,10 @@
|
|
2
2
|
|
3
3
|
These classes provide simple read and write access to the Chord OMS API. Get started like this:
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
},
|
10
|
-
production: {
|
11
|
-
base_url: 'https://<customer>.assembly-api.com/api/',
|
12
|
-
api_key: '<key>'
|
13
|
-
}
|
14
|
-
}
|
5
|
+
Chord.config(
|
6
|
+
base_url: 'https://<customer>.staging.assembly-api.com/api/',
|
7
|
+
api_key: '<key>'
|
8
|
+
)
|
15
9
|
|
16
10
|
u = Chord::User.find(1) # fetch user
|
17
11
|
u.attributes # see attributes hash
|
data/bin/console
CHANGED
data/lib/chord/version.rb
CHANGED
data/lib/chord.rb
CHANGED
@@ -3,8 +3,24 @@ require 'httparty'
|
|
3
3
|
module Chord
|
4
4
|
|
5
5
|
class << self
|
6
|
-
|
7
|
-
|
6
|
+
attr_accessor :base_url
|
7
|
+
attr_accessor :api_key
|
8
|
+
|
9
|
+
def config(options)
|
10
|
+
self.base_url = options[:base_url]
|
11
|
+
self.api_key = options[:api_key]
|
12
|
+
end
|
13
|
+
|
14
|
+
def config_from_file(filepath)
|
15
|
+
if File.exist?(filepath)
|
16
|
+
require 'yaml'
|
17
|
+
config = YAML.load(File.read(filepath), symbolize_names: true)
|
18
|
+
Chord.config(
|
19
|
+
base_url: config[:base_url],
|
20
|
+
api_key: config[:api_key]
|
21
|
+
)
|
22
|
+
end
|
23
|
+
end
|
8
24
|
end
|
9
25
|
|
10
26
|
class Base
|
@@ -35,12 +51,12 @@ module Chord
|
|
35
51
|
end
|
36
52
|
|
37
53
|
def base_url
|
38
|
-
|
54
|
+
Chord.base_url
|
39
55
|
end
|
40
56
|
|
41
57
|
def http_options
|
42
58
|
{headers: {
|
43
|
-
'Authorization' => "Bearer #{
|
59
|
+
'Authorization' => "Bearer #{Chord.api_key}",
|
44
60
|
'Content-Type' => 'application/json'
|
45
61
|
}}
|
46
62
|
end
|
@@ -176,6 +192,14 @@ module Chord
|
|
176
192
|
http_options.merge(body: attributes.to_json)
|
177
193
|
).parsed_response
|
178
194
|
end
|
195
|
+
|
196
|
+
def subscription_installment?
|
197
|
+
channel == 'subscriptions'
|
198
|
+
end
|
199
|
+
|
200
|
+
def subscription_start?
|
201
|
+
subscription_in_cart
|
202
|
+
end
|
179
203
|
end
|
180
204
|
|
181
205
|
|