chord 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +4 -10
- data/bin/console +1 -4
- data/lib/chord/version.rb +1 -1
- data/lib/chord.rb +31 -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: d87fc026e550a99125b7aac97b1069d943ccc8b6c23f4bface9ae5136d2fd48d
|
4
|
+
data.tar.gz: ca017e9919b6323d25f0dbac900598be630c843120bef07f1db29787e94b675d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e027f417299124bbcf66d573ddd4ddb36f9a3c3d193385df49b2499ed9658543b58375064ba4cd583777a66be63ef685c036ba3616f7813bd34ebd857753d34a
|
7
|
+
data.tar.gz: fc10bf3c2ff5b9fd59048024ff07f3288b9593aea3da6a90fc35b11697d992bdcc48b00d873bbc07685b63440e9a228dc27330409568d98073f1e9adc51c0416
|
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,17 @@ 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
|
+
unless attributes.include?('subscription_in_cart')
|
202
|
+
attributes['subscription_in_cart'] = Chord::Order.find(number).subscription_in_cart
|
203
|
+
end
|
204
|
+
subscription_in_cart
|
205
|
+
end
|
179
206
|
end
|
180
207
|
|
181
208
|
|