chord 0.0.8 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/chord/version.rb +1 -1
- data/lib/chord.rb +12 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51366f4b872ac5d7c80a70e2dadf6c30f0c9ea4de1074b226c5db26e266a6d17
|
4
|
+
data.tar.gz: 9776566920c970c6845b5b9006f9cd9fc91e47ae70598cfe33bb181705d2adef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b70fa38155d6672b5539ebddf2f932db2a9450097faef255dc3dac0d1add286aa3326c7ed05a39f584f77e4fc6f3b93f61f81de339219c395acff8dc6ab95ab
|
7
|
+
data.tar.gz: 3b88f84c35d1e05f2150bc5bd3f42094bab73ec775e8d7d28374d451cf12bd8a0a9401a860cf1cdbf349e30371017d930b4414c2e93642c021364c9d80da2576
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
Major changes for each release. Please see the Git log for complete list of changes.
|
4
4
|
|
5
|
+
## 0.0.10
|
6
|
+
|
7
|
+
* Don't allow public writing of @attributes.
|
8
|
+
* Add Order#complete? method.
|
9
|
+
|
10
|
+
## 0.0.9
|
11
|
+
|
12
|
+
* When API error on update, don't update object attributes.
|
13
|
+
|
5
14
|
## 0.0.8
|
6
15
|
|
7
16
|
* Don't preserve existing attributes when calling `expand!`.
|
data/lib/chord/version.rb
CHANGED
data/lib/chord.rb
CHANGED
@@ -117,7 +117,7 @@ module Chord
|
|
117
117
|
end
|
118
118
|
|
119
119
|
attr_reader :id
|
120
|
-
|
120
|
+
attr_reader :attributes
|
121
121
|
|
122
122
|
def initialize(id, attributes = {})
|
123
123
|
@id = id
|
@@ -125,9 +125,14 @@ module Chord
|
|
125
125
|
end
|
126
126
|
|
127
127
|
def update(new_attributes)
|
128
|
-
|
128
|
+
response = self.class.patch(base_url + "#{base_path}/#{id}",
|
129
129
|
http_options.merge(body: new_attributes.to_json)
|
130
130
|
).parsed_response
|
131
|
+
if response.include?('error')
|
132
|
+
raise APIError, "Chord API error (status #{response['status']}): #{response['error']}"
|
133
|
+
else
|
134
|
+
@attributes = response
|
135
|
+
end
|
131
136
|
end
|
132
137
|
|
133
138
|
def delete
|
@@ -137,7 +142,7 @@ module Chord
|
|
137
142
|
# fetch all attributes, but don't overwrite existing ones,
|
138
143
|
# in case changes have been made
|
139
144
|
def expand!
|
140
|
-
|
145
|
+
@attributes = self.class.send(:fetch_attributes, id)
|
141
146
|
end
|
142
147
|
|
143
148
|
def method_missing(method, *args, &block)
|
@@ -188,6 +193,10 @@ module Chord
|
|
188
193
|
'number'
|
189
194
|
end
|
190
195
|
|
196
|
+
def complete?
|
197
|
+
state == 'complete'
|
198
|
+
end
|
199
|
+
|
191
200
|
def user
|
192
201
|
@user ||= Chord::User.find(attributes['user_id'])
|
193
202
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Reisner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|