typekit-client 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/Guardfile +18 -4
  4. data/README.md +62 -39
  5. data/bin/{typekit → typekit-client} +14 -1
  6. data/bin/typekit-publisher +89 -0
  7. data/lib/typekit/client.rb +6 -10
  8. data/lib/typekit/collection.rb +15 -0
  9. data/lib/typekit/core.rb +3 -3
  10. data/lib/typekit/helper.rb +4 -0
  11. data/lib/typekit/processing/converter/boolean.rb +3 -0
  12. data/lib/typekit/processing/converter/collection.rb +18 -0
  13. data/lib/typekit/processing/converter/datetime.rb +3 -0
  14. data/lib/typekit/processing/converter/errors.rb +3 -1
  15. data/lib/typekit/processing/converter/record.rb +2 -1
  16. data/lib/typekit/processing/converter.rb +8 -13
  17. data/lib/typekit/record/base.rb +30 -8
  18. data/lib/typekit/record/family.rb +2 -1
  19. data/lib/typekit/record/kit.rb +1 -1
  20. data/lib/typekit/record/library.rb +1 -1
  21. data/lib/typekit/record/variation.rb +2 -2
  22. data/lib/typekit/record.rb +18 -18
  23. data/lib/typekit/version.rb +1 -1
  24. data/lib/typekit.rb +2 -0
  25. data/spec/cassettes/{show_families_calluna_found.yml → show_families_xxx_found.yml} +1 -1
  26. data/spec/cassettes/show_families_xxx_ok.yml +31 -0
  27. data/spec/cassettes/show_families_xxx_yyy_ok.yml +20 -0
  28. data/spec/cassettes/show_kits_xxx_families_yyy_ok.yml +16 -0
  29. data/spec/cassettes/show_kits_xxx_ok.yml +17 -0
  30. data/spec/cassettes/show_libraries_xxx_ok.yml +31 -0
  31. data/spec/features/client/delete_kit_spec.rb +13 -0
  32. data/spec/features/client/index_kits_spec.rb +25 -0
  33. data/spec/features/client/show_family_spec.rb +47 -0
  34. data/spec/features/client/show_kit_spec.rb +18 -0
  35. data/spec/features/client/show_library_spec.rb +18 -0
  36. data/spec/features/client/show_variation_spec.rb +22 -0
  37. data/spec/spec_helper.rb +3 -5
  38. data/spec/support/resource_helper.rb +34 -0
  39. data/spec/typekit/helper_spec.rb +12 -5
  40. data/spec/typekit/processing/converter_spec.rb +1 -1
  41. data/spec/typekit/record/base_spec.rb +56 -3
  42. data/spec/typekit/record_spec.rb +57 -24
  43. data/typekit-client.gemspec +1 -1
  44. metadata +36 -13
  45. data/lib/typekit/processing/converter/records.rb +0 -18
  46. data/spec/support/rest_helper.rb +0 -22
  47. data/spec/typekit/client_spec.rb +0 -42
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typekit-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Ukhov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-01 00:00:00.000000000 Z
11
+ date: 2014-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '2.14'
89
+ version: '3.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '2.14'
96
+ version: '3.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: guard-rspec
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -141,7 +141,8 @@ description: A Ruby library for manipulating the resources provided by the Typek
141
141
  email:
142
142
  - ivan.ukhov@gmail.com
143
143
  executables:
144
- - typekit
144
+ - typekit-client
145
+ - typekit-publisher
145
146
  extensions: []
146
147
  extra_rdoc_files: []
147
148
  files:
@@ -154,18 +155,20 @@ files:
154
155
  - LICENSE.txt
155
156
  - README.md
156
157
  - Rakefile
157
- - bin/typekit
158
+ - bin/typekit-client
159
+ - bin/typekit-publisher
158
160
  - lib/typekit.rb
159
161
  - lib/typekit/client.rb
162
+ - lib/typekit/collection.rb
160
163
  - lib/typekit/core.rb
161
164
  - lib/typekit/helper.rb
162
165
  - lib/typekit/processing.rb
163
166
  - lib/typekit/processing/converter.rb
164
167
  - lib/typekit/processing/converter/boolean.rb
168
+ - lib/typekit/processing/converter/collection.rb
165
169
  - lib/typekit/processing/converter/datetime.rb
166
170
  - lib/typekit/processing/converter/errors.rb
167
171
  - lib/typekit/processing/converter/record.rb
168
- - lib/typekit/processing/converter/records.rb
169
172
  - lib/typekit/processing/converter/unknown.rb
170
173
  - lib/typekit/processing/translator.rb
171
174
  - lib/typekit/record.rb
@@ -178,10 +181,20 @@ files:
178
181
  - spec/cassettes/delete_kits_xxx_ok.yml
179
182
  - spec/cassettes/index_kits_ok.yml
180
183
  - spec/cassettes/index_kits_unauthorized.yml
181
- - spec/cassettes/show_families_calluna_found.yml
184
+ - spec/cassettes/show_families_xxx_found.yml
185
+ - spec/cassettes/show_families_xxx_ok.yml
186
+ - spec/cassettes/show_families_xxx_yyy_ok.yml
187
+ - spec/cassettes/show_kits_xxx_families_yyy_ok.yml
188
+ - spec/cassettes/show_kits_xxx_ok.yml
189
+ - spec/cassettes/show_libraries_xxx_ok.yml
190
+ - spec/features/client/delete_kit_spec.rb
191
+ - spec/features/client/index_kits_spec.rb
192
+ - spec/features/client/show_family_spec.rb
193
+ - spec/features/client/show_kit_spec.rb
194
+ - spec/features/client/show_library_spec.rb
195
+ - spec/features/client/show_variation_spec.rb
182
196
  - spec/spec_helper.rb
183
- - spec/support/rest_helper.rb
184
- - spec/typekit/client_spec.rb
197
+ - spec/support/resource_helper.rb
185
198
  - spec/typekit/helper_spec.rb
186
199
  - spec/typekit/processing/converter_spec.rb
187
200
  - spec/typekit/record/base_spec.rb
@@ -215,10 +228,20 @@ test_files:
215
228
  - spec/cassettes/delete_kits_xxx_ok.yml
216
229
  - spec/cassettes/index_kits_ok.yml
217
230
  - spec/cassettes/index_kits_unauthorized.yml
218
- - spec/cassettes/show_families_calluna_found.yml
231
+ - spec/cassettes/show_families_xxx_found.yml
232
+ - spec/cassettes/show_families_xxx_ok.yml
233
+ - spec/cassettes/show_families_xxx_yyy_ok.yml
234
+ - spec/cassettes/show_kits_xxx_families_yyy_ok.yml
235
+ - spec/cassettes/show_kits_xxx_ok.yml
236
+ - spec/cassettes/show_libraries_xxx_ok.yml
237
+ - spec/features/client/delete_kit_spec.rb
238
+ - spec/features/client/index_kits_spec.rb
239
+ - spec/features/client/show_family_spec.rb
240
+ - spec/features/client/show_kit_spec.rb
241
+ - spec/features/client/show_library_spec.rb
242
+ - spec/features/client/show_variation_spec.rb
219
243
  - spec/spec_helper.rb
220
- - spec/support/rest_helper.rb
221
- - spec/typekit/client_spec.rb
244
+ - spec/support/resource_helper.rb
222
245
  - spec/typekit/helper_spec.rb
223
246
  - spec/typekit/processing/converter_spec.rb
224
247
  - spec/typekit/record/base_spec.rb
@@ -1,18 +0,0 @@
1
- module Typekit
2
- module Processing
3
- module Converter
4
- class Records
5
- def initialize(name)
6
- name = Helper.singularize(name.to_s).capitalize
7
- @klass = Typekit::Record.const_get(name)
8
- end
9
-
10
- def process(response, attribute_collection)
11
- attribute_collection.map do |attributes|
12
- @klass.new(attributes)
13
- end
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,22 +0,0 @@
1
- module RESTHelper
2
- def restful_actions
3
- # TODO: keep in sync with Typekit.actions?
4
- [ :index, :show, :create, :update, :delete ]
5
- end
6
-
7
- def restful_collection_actions
8
- # TODO: keep in sync with Typekit.collection_actions?
9
- [ :index, :create ]
10
- end
11
-
12
- def restful_member_actions
13
- # TODO: keep in sync with Typekit.member_actions?
14
- [ :show, :update, :delete ]
15
- end
16
-
17
- def rest_http_dictionary
18
- # TODO: keep in sync with Typekit.action_dictionary?
19
- { :index => :get, :show => :get, :create => :post,
20
- :update => :post, :delete => :delete }
21
- end
22
- end
@@ -1,42 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Typekit::Client do
4
- let(:token) { 'arbitrary' }
5
- let(:subject) { Typekit::Client.new(token: token) }
6
-
7
- describe '#index' do
8
- context 'when successful' do
9
- options = { vcr: { cassette_name: 'index_kits_ok' } }
10
-
11
- it 'returns Records', options do
12
- result = subject.index(:kits)
13
- expect(result.map(&:class).uniq).to eq([ Typekit::Record::Kit ])
14
- end
15
- end
16
-
17
- context 'when unauthorized' do
18
- options = { vcr: { cassette_name: 'index_kits_unauthorized' } }
19
-
20
- it 'raises exceptions', options do
21
- expect { subject.index(:kits) }.to \
22
- raise_error(Typekit::Processing::Error, /Not authorized/i)
23
- end
24
- end
25
-
26
- context 'when found' do
27
- options = { vcr: { cassette_name: 'show_families_calluna_found' } }
28
-
29
- it 'returns the Response as is', options do
30
- expect { subject.show(:families, 'calluna') }.not_to raise_error
31
- end
32
- end
33
- end
34
-
35
- describe '#delete' do
36
- options = { vcr: { cassette_name: 'delete_kits_xxx_ok' } }
37
-
38
- it 'returns true', options do
39
- expect(subject.delete(:kits, 'xxx')).to be(true)
40
- end
41
- end
42
- end