shopify_client 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +30 -0
  6. data/Rakefile +11 -0
  7. data/lib/shopify_client.rb +10 -0
  8. data/lib/shopify_client/api/custom_collection.rb +22 -0
  9. data/lib/shopify_client/api/order.rb +22 -0
  10. data/lib/shopify_client/api/product.rb +21 -0
  11. data/lib/shopify_client/api/recurring_application_charge.rb +43 -0
  12. data/lib/shopify_client/api/script_tag.rb +35 -0
  13. data/lib/shopify_client/api/shop.rb +16 -0
  14. data/lib/shopify_client/api/smart_collection.rb +22 -0
  15. data/lib/shopify_client/api/webhook.rb +34 -0
  16. data/lib/shopify_client/base.rb +57 -0
  17. data/lib/shopify_client/client.rb +91 -0
  18. data/lib/shopify_client/custom_collection.rb +28 -0
  19. data/lib/shopify_client/error.rb +13 -0
  20. data/lib/shopify_client/error/client_error.rb +23 -0
  21. data/lib/shopify_client/error/server_error.rb +15 -0
  22. data/lib/shopify_client/image.rb +13 -0
  23. data/lib/shopify_client/order.rb +29 -0
  24. data/lib/shopify_client/product.rb +22 -0
  25. data/lib/shopify_client/recurring_application_charge.rb +20 -0
  26. data/lib/shopify_client/request/content_type.rb +20 -0
  27. data/lib/shopify_client/response/parse_json.rb +22 -0
  28. data/lib/shopify_client/response/raise_error.rb +23 -0
  29. data/lib/shopify_client/script_tag.rb +19 -0
  30. data/lib/shopify_client/shop.rb +22 -0
  31. data/lib/shopify_client/smart_collection.rb +28 -0
  32. data/lib/shopify_client/version.rb +3 -0
  33. data/lib/shopify_client/webhook.rb +21 -0
  34. data/shopify_client.gemspec +28 -0
  35. data/test/fixtures/custom_collection.json +18 -0
  36. data/test/fixtures/custom_collections.json +19 -0
  37. data/test/fixtures/order.json +274 -0
  38. data/test/fixtures/orders.json +276 -0
  39. data/test/fixtures/product.json +140 -0
  40. data/test/fixtures/products.json +170 -0
  41. data/test/fixtures/recurring_application_charge.json +18 -0
  42. data/test/fixtures/recurring_application_charges.json +34 -0
  43. data/test/fixtures/script_tag.json +9 -0
  44. data/test/fixtures/script_tags.json +18 -0
  45. data/test/fixtures/shop.json +37 -0
  46. data/test/fixtures/smart_collection.json +25 -0
  47. data/test/fixtures/smart_collections.json +26 -0
  48. data/test/fixtures/webhook.json +10 -0
  49. data/test/fixtures/webhooks.json +20 -0
  50. data/test/shopify_client/api/custom_collection_spec.rb +54 -0
  51. data/test/shopify_client/api/order_spec.rb +68 -0
  52. data/test/shopify_client/api/product_spec.rb +66 -0
  53. data/test/shopify_client/api/recurring_application_charge_spec.rb +138 -0
  54. data/test/shopify_client/api/script_tag_spec.rb +109 -0
  55. data/test/shopify_client/api/shop_spec.rb +30 -0
  56. data/test/shopify_client/api/smart_collection_spec.rb +54 -0
  57. data/test/shopify_client/api/webhook_spec.rb +109 -0
  58. data/test/shopify_client/base_spec.rb +12 -0
  59. data/test/shopify_client/client_spec.rb +12 -0
  60. data/test/shopify_client/custom_collection_spec.rb +41 -0
  61. data/test/shopify_client/error/client_error_spec.rb +19 -0
  62. data/test/shopify_client/error/server_error_spec.rb +20 -0
  63. data/test/shopify_client/order_spec.rb +30 -0
  64. data/test/shopify_client/product_spec.rb +21 -0
  65. data/test/shopify_client/recurring_application_charge_spec.rb +20 -0
  66. data/test/shopify_client/script_tag_spec.rb +22 -0
  67. data/test/shopify_client/shop_spec.rb +14 -0
  68. data/test/shopify_client/smart_collection_spec.rb +41 -0
  69. data/test/shopify_client/webhook_spec.rb +22 -0
  70. data/test/shopify_client_spec.rb +10 -0
  71. data/test/test_helper.rb +13 -0
  72. metadata +235 -0
@@ -0,0 +1,21 @@
1
+ describe ShopifyClient::Product do
2
+
3
+ before do
4
+ @product = ShopifyClient::Product.new({ :body_html => "<p>It's the small iPod with one very big idea</p>",
5
+ :handle => "ipod-nano",
6
+ :id => 632910392,
7
+ :product_type => "Cult Products",
8
+ :published_at => "2007-12-31T19:00:00-05:00",
9
+ :published_scope => "global",
10
+ :title => "IPod Nano - 8GB"
11
+ })
12
+
13
+ end
14
+
15
+ describe "#handle" do
16
+ it "returns the product's handle" do
17
+ @product.handle.must_equal 'ipod-nano'
18
+ end
19
+ end
20
+
21
+ end
@@ -0,0 +1,20 @@
1
+ describe ShopifyClient::RecurringApplicationCharge do
2
+
3
+ before do
4
+ @recurring_application_charge = ShopifyClient::RecurringApplicationCharge.new({ :id => 455696195,
5
+ :name => "Super Mega Plan",
6
+ :price => "15.00",
7
+ :return_url => "http://yourapp.com",
8
+ :status => "pending"
9
+ })
10
+
11
+
12
+ end
13
+
14
+ describe "#name" do
15
+ it "returns the recurring_application_charge's name " do
16
+ @recurring_application_charge.name.must_equal 'Super Mega Plan'
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,22 @@
1
+ describe ShopifyClient::ScriptTag do
2
+
3
+ before do
4
+ @script_tag = ShopifyClient::ScriptTag.new({ created_at: "2013-08-01T11:13:08-04:00",
5
+ event: "onload",
6
+ id: 596726825,
7
+ src: "http://js-aplenty.com/foo.js",
8
+ updated_at: "2013-08-01T11:13:08-04:00"
9
+ })
10
+
11
+ end
12
+
13
+ describe "#src" do
14
+ it "returns the script_tag's src" do
15
+ @script_tag.src.must_equal 'http://js-aplenty.com/foo.js'
16
+ end
17
+ end
18
+
19
+ end
20
+
21
+
22
+
@@ -0,0 +1,14 @@
1
+ describe ShopifyClient::Shop do
2
+
3
+ before do
4
+ @shop = ShopifyClient::Shop.new({ :id => 1, :name => "Example Shop",
5
+ :email => "example@shopify.com" })
6
+ end
7
+
8
+ describe "#name" do
9
+ it "returns the shop's name" do
10
+ @shop.name.must_equal "Example Shop"
11
+ end
12
+ end
13
+
14
+ end
@@ -0,0 +1,41 @@
1
+ describe ShopifyClient::SmartCollection do
2
+
3
+ before do
4
+ @smart_collection = ShopifyClient::SmartCollection.new({ :body_html => "<p>The best selling ipod ever</p>",
5
+ :handle => "smart-ipods",
6
+ :id => 482865238,
7
+ :products_count => 0,
8
+ :image => {
9
+ :created_at => "2013-07-18T13:55:42-04:00",
10
+ :src => "http://cdn.shopify.com/s/files/1/0006/9093/3842/collections/ipod_nano_8gb.jpg"
11
+ }
12
+ })
13
+
14
+ end
15
+
16
+ describe "#handle" do
17
+ it "returns the collection's handle" do
18
+ @smart_collection.handle.must_equal 'smart-ipods'
19
+ end
20
+ end
21
+
22
+ describe "#image" do
23
+ it "returns a ShopifyClient::Image" do
24
+ @smart_collection.image.must_be_instance_of ShopifyClient::Image
25
+ end
26
+ describe "when image attribute is nil" do
27
+ before do
28
+ @smart_collection = ShopifyClient::SmartCollection.new({ :body_html => "<p>The best selling ipod ever</p>",
29
+ :handle => "ipods",
30
+ :id => 841564295,
31
+ :products_count => 1
32
+ })
33
+ end
34
+
35
+ it "returns nil" do
36
+ @smart_collection.image.must_be_nil
37
+ end
38
+ end
39
+ end
40
+
41
+ end
@@ -0,0 +1,22 @@
1
+ describe ShopifyClient::Webhook do
2
+
3
+ before do
4
+ @webhook = ShopifyClient::Webhook.new({ :address => "http://apple.com",
5
+ :created_at => "2013-07-18T13:55:43-04:00",
6
+ :format => "json",
7
+ :id => 4759306,
8
+ :topic => "orders/create",
9
+ :updated_at => "2013-07-18T13:55:43-04:00"
10
+ })
11
+
12
+ end
13
+
14
+ describe "#topic" do
15
+ it "returns the webhook's topic" do
16
+ @webhook.topic.must_equal 'orders/create'
17
+ end
18
+ end
19
+
20
+ end
21
+
22
+
@@ -0,0 +1,10 @@
1
+ describe ShopifyClient do
2
+
3
+ describe ".new" do
4
+ it "returns a ShopifyClient::Client instance" do
5
+ client = ShopifyClient.new("http://example.myshopify.com", "abc")
6
+ client.must_be_instance_of ShopifyClient::Client
7
+ end
8
+ end
9
+
10
+ end
@@ -0,0 +1,13 @@
1
+ require 'shopify_client'
2
+ require 'minitest'
3
+ require 'webmock/minitest'
4
+ require 'minitest/autorun'
5
+
6
+ def fixture_path
7
+ File.expand_path('../fixtures', __FILE__)
8
+ end
9
+
10
+ def fixture(file)
11
+ File.new(fixture_path + '/' + file)
12
+ end
13
+
metadata ADDED
@@ -0,0 +1,235 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: shopify_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Esteban Pastorino
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '0.8'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '0.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: multi_json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 5.0.6
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 5.0.6
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 1.13.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 1.13.0
97
+ description: Intented to be a thread-safe replacement of shopify_api.
98
+ email:
99
+ - ejpastorino@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - .gitignore
105
+ - Gemfile
106
+ - LICENSE.txt
107
+ - README.md
108
+ - Rakefile
109
+ - lib/shopify_client.rb
110
+ - lib/shopify_client/api/custom_collection.rb
111
+ - lib/shopify_client/api/order.rb
112
+ - lib/shopify_client/api/product.rb
113
+ - lib/shopify_client/api/recurring_application_charge.rb
114
+ - lib/shopify_client/api/script_tag.rb
115
+ - lib/shopify_client/api/shop.rb
116
+ - lib/shopify_client/api/smart_collection.rb
117
+ - lib/shopify_client/api/webhook.rb
118
+ - lib/shopify_client/base.rb
119
+ - lib/shopify_client/client.rb
120
+ - lib/shopify_client/custom_collection.rb
121
+ - lib/shopify_client/error.rb
122
+ - lib/shopify_client/error/client_error.rb
123
+ - lib/shopify_client/error/server_error.rb
124
+ - lib/shopify_client/image.rb
125
+ - lib/shopify_client/order.rb
126
+ - lib/shopify_client/product.rb
127
+ - lib/shopify_client/recurring_application_charge.rb
128
+ - lib/shopify_client/request/content_type.rb
129
+ - lib/shopify_client/response/parse_json.rb
130
+ - lib/shopify_client/response/raise_error.rb
131
+ - lib/shopify_client/script_tag.rb
132
+ - lib/shopify_client/shop.rb
133
+ - lib/shopify_client/smart_collection.rb
134
+ - lib/shopify_client/version.rb
135
+ - lib/shopify_client/webhook.rb
136
+ - shopify_client.gemspec
137
+ - test/fixtures/custom_collection.json
138
+ - test/fixtures/custom_collections.json
139
+ - test/fixtures/order.json
140
+ - test/fixtures/orders.json
141
+ - test/fixtures/product.json
142
+ - test/fixtures/products.json
143
+ - test/fixtures/recurring_application_charge.json
144
+ - test/fixtures/recurring_application_charges.json
145
+ - test/fixtures/script_tag.json
146
+ - test/fixtures/script_tags.json
147
+ - test/fixtures/shop.json
148
+ - test/fixtures/smart_collection.json
149
+ - test/fixtures/smart_collections.json
150
+ - test/fixtures/webhook.json
151
+ - test/fixtures/webhooks.json
152
+ - test/shopify_client/api/custom_collection_spec.rb
153
+ - test/shopify_client/api/order_spec.rb
154
+ - test/shopify_client/api/product_spec.rb
155
+ - test/shopify_client/api/recurring_application_charge_spec.rb
156
+ - test/shopify_client/api/script_tag_spec.rb
157
+ - test/shopify_client/api/shop_spec.rb
158
+ - test/shopify_client/api/smart_collection_spec.rb
159
+ - test/shopify_client/api/webhook_spec.rb
160
+ - test/shopify_client/base_spec.rb
161
+ - test/shopify_client/client_spec.rb
162
+ - test/shopify_client/custom_collection_spec.rb
163
+ - test/shopify_client/error/client_error_spec.rb
164
+ - test/shopify_client/error/server_error_spec.rb
165
+ - test/shopify_client/order_spec.rb
166
+ - test/shopify_client/product_spec.rb
167
+ - test/shopify_client/recurring_application_charge_spec.rb
168
+ - test/shopify_client/script_tag_spec.rb
169
+ - test/shopify_client/shop_spec.rb
170
+ - test/shopify_client/smart_collection_spec.rb
171
+ - test/shopify_client/webhook_spec.rb
172
+ - test/shopify_client_spec.rb
173
+ - test/test_helper.rb
174
+ homepage: https://github.com/kitop/shopify_client
175
+ licenses:
176
+ - MIT
177
+ metadata: {}
178
+ post_install_message:
179
+ rdoc_options: []
180
+ require_paths:
181
+ - lib
182
+ required_ruby_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - '>='
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ required_rubygems_version: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - '>='
190
+ - !ruby/object:Gem::Version
191
+ version: '0'
192
+ requirements: []
193
+ rubyforge_project:
194
+ rubygems_version: 2.0.3
195
+ signing_key:
196
+ specification_version: 4
197
+ summary: Shopify API client.
198
+ test_files:
199
+ - test/fixtures/custom_collection.json
200
+ - test/fixtures/custom_collections.json
201
+ - test/fixtures/order.json
202
+ - test/fixtures/orders.json
203
+ - test/fixtures/product.json
204
+ - test/fixtures/products.json
205
+ - test/fixtures/recurring_application_charge.json
206
+ - test/fixtures/recurring_application_charges.json
207
+ - test/fixtures/script_tag.json
208
+ - test/fixtures/script_tags.json
209
+ - test/fixtures/shop.json
210
+ - test/fixtures/smart_collection.json
211
+ - test/fixtures/smart_collections.json
212
+ - test/fixtures/webhook.json
213
+ - test/fixtures/webhooks.json
214
+ - test/shopify_client/api/custom_collection_spec.rb
215
+ - test/shopify_client/api/order_spec.rb
216
+ - test/shopify_client/api/product_spec.rb
217
+ - test/shopify_client/api/recurring_application_charge_spec.rb
218
+ - test/shopify_client/api/script_tag_spec.rb
219
+ - test/shopify_client/api/shop_spec.rb
220
+ - test/shopify_client/api/smart_collection_spec.rb
221
+ - test/shopify_client/api/webhook_spec.rb
222
+ - test/shopify_client/base_spec.rb
223
+ - test/shopify_client/client_spec.rb
224
+ - test/shopify_client/custom_collection_spec.rb
225
+ - test/shopify_client/error/client_error_spec.rb
226
+ - test/shopify_client/error/server_error_spec.rb
227
+ - test/shopify_client/order_spec.rb
228
+ - test/shopify_client/product_spec.rb
229
+ - test/shopify_client/recurring_application_charge_spec.rb
230
+ - test/shopify_client/script_tag_spec.rb
231
+ - test/shopify_client/shop_spec.rb
232
+ - test/shopify_client/smart_collection_spec.rb
233
+ - test/shopify_client/webhook_spec.rb
234
+ - test/shopify_client_spec.rb
235
+ - test/test_helper.rb