chord 0.0.9 → 0.0.11

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
  SHA256:
3
- metadata.gz: 8e83b6981808cf5864784c21d0558273fa3edc0099f43d495ef06d556c36f08e
4
- data.tar.gz: 8b4a00fc5b097a03b527097350fab0f38ed21871f5279e2a58d9fef58dc60b80
3
+ metadata.gz: 7a27f065d2d16ad513192176bbf77afde6d6167f3d6aefea2e6b9a7bd0ec5237
4
+ data.tar.gz: 348b79a92190b2e503cef0370a7666ddbf8b06e8b4e2f6f6ccaf60280377b32e
5
5
  SHA512:
6
- metadata.gz: 28c212e87eb22ea7a0fa807949ecd0470154abc16761d1847411cb9d516518febaf0da6e754558895e13fd7ecf0cd4660685a6593b9b554549cc3b87ed28d2a6
7
- data.tar.gz: 9e84d6c2edf9cb3526184f13121099e3ecd8ee9412b5563a311c41f2910d09b229b7f5de1c10ca215fd5274b48a46114aba8221430bb1700818862bc35f41072
6
+ metadata.gz: 3d89ea3d805da2ce7e670733a34bef7970b49ec060598f5a006584015d4d7233936b6a1b5f37617395e34ff9f8864879b55d30f8e51958f0c1390268d4379791
7
+ data.tar.gz: 7e75d711858ebf52aa74c48b11d362c819d2db5d465cb0f814bb3195ec880167ab9e2b25fea52edf68fe8428c318dd64e3c9e5bc3f665c57d17e9befd2080344
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.11
6
+
7
+ * Add LineItem model (rough/WIP).
8
+
9
+ ## 0.0.10
10
+
11
+ * Don't allow public writing of @attributes.
12
+ * Add Order#complete? method.
13
+
5
14
  ## 0.0.9
6
15
 
7
16
  * When API error on update, don't update object attributes.
data/lib/chord/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Chord
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.11"
3
3
  end
data/lib/chord.rb CHANGED
@@ -117,7 +117,7 @@ module Chord
117
117
  end
118
118
 
119
119
  attr_reader :id
120
- attr_accessor :attributes
120
+ attr_reader :attributes
121
121
 
122
122
  def initialize(id, attributes = {})
123
123
  @id = id
@@ -131,7 +131,7 @@ module Chord
131
131
  if response.include?('error')
132
132
  raise APIError, "Chord API error (status #{response['status']}): #{response['error']}"
133
133
  else
134
- self.attributes = response
134
+ @attributes = response
135
135
  end
136
136
  end
137
137
 
@@ -142,7 +142,7 @@ module Chord
142
142
  # fetch all attributes, but don't overwrite existing ones,
143
143
  # in case changes have been made
144
144
  def expand!
145
- self.attributes = self.class.send(:fetch_attributes, id)
145
+ @attributes = self.class.send(:fetch_attributes, id)
146
146
  end
147
147
 
148
148
  def method_missing(method, *args, &block)
@@ -193,6 +193,14 @@ module Chord
193
193
  'number'
194
194
  end
195
195
 
196
+ def line_items
197
+ @attributes['line_items'].map{ |i| LineItem.new(i['id'], i) }
198
+ end
199
+
200
+ def complete?
201
+ state == 'complete'
202
+ end
203
+
196
204
  def user
197
205
  @user ||= Chord::User.find(attributes['user_id'])
198
206
  end
@@ -222,6 +230,14 @@ module Chord
222
230
  end
223
231
 
224
232
 
233
+ class LineItem < Base
234
+
235
+ def subscription?
236
+ subscription_line_items.size > 0
237
+ end
238
+ end
239
+
240
+
225
241
  class Role < Base
226
242
 
227
243
  def self.base_path
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.9
4
+ version: 0.0.11
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-26 00:00:00.000000000 Z
11
+ date: 2022-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty