shopify_api 3.0.2 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == Version 3.0.3
2
+
3
+ * Add a `customers` helper method to the CustomerGroup resource
4
+
1
5
  == Version 3.0.2
2
6
 
3
7
  * Brevity in require statements
@@ -10,5 +10,13 @@ module ActiveResource
10
10
  @headers
11
11
  end
12
12
  end
13
+ # https://github.com/rails/activeresource/commit/dfef85ce8f653f75673631b2950fcdb0781c313c
14
+ def self.delete(id, options = {})
15
+ connection.delete(element_path(id, options), headers)
16
+ end
17
+ def self.build(attributes = {})
18
+ attrs = self.format.decode(connection.get("#{new_element_path}", headers).body).merge(attributes)
19
+ self.new(attrs)
20
+ end
13
21
  end
14
22
  end
@@ -0,0 +1,4 @@
1
+ module ShopifyAPI
2
+ class Checkout < Base
3
+ end
4
+ end
@@ -1,4 +1,7 @@
1
1
  module ShopifyAPI
2
2
  class CustomerGroup < Base
3
+ def customers
4
+ Customers.find(:all, :params => {:customer_group_id => self.id})
5
+ end
3
6
  end
4
7
  end
@@ -5,7 +5,7 @@ module ShopifyAPI
5
5
 
6
6
  # compute the price range
7
7
  def price_range
8
- prices = variants.collect(&:price)
8
+ prices = variants.collect(&:price).collect(&:to_f)
9
9
  format = "%0.2f"
10
10
  if prices.min != prices.max
11
11
  "#{format % prices.min} - #{format % prices.max}"
@@ -1,3 +1,3 @@
1
1
  module ShopifyAPI
2
- VERSION = "3.0.2"
2
+ VERSION = "3.0.3"
3
3
  end
data/test/base_test.rb CHANGED
@@ -47,4 +47,18 @@ class BaseTest < Test::Unit::TestCase
47
47
  assert_equal 'token2', ShopifyAPI::Shop.headers['X-Shopify-Access-Token']
48
48
  end
49
49
 
50
- end
50
+ test "#delete should send custom headers with request" do
51
+ ShopifyAPI::Base.activate_session @session1
52
+ ShopifyAPI::Base.expects(:headers).returns({'X-Custom' => 'abc'})
53
+ ShopifyAPI::Base.connection.expects(:delete).with('/admin/bases/1.json', {'X-Custom' => 'abc'})
54
+ ShopifyAPI::Base.delete "1"
55
+ end
56
+
57
+ test "#build should send custom headers with request" do
58
+ ShopifyAPI::Base.activate_session @session1
59
+ ShopifyAPI::Base.expects(:headers).returns({'X-Custom' => 'abc'})
60
+ ShopifyAPI::Base.connection.expects(:delete).with('/admin/bases/1.json', {'X-Custom' => 'abc'})
61
+ ShopifyAPI::Base.delete "1"
62
+ end
63
+
64
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-01 00:00:00.000000000 Z
12
+ date: 2012-11-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activeresource
@@ -117,6 +117,7 @@ files:
117
117
  - lib/shopify_api/resources/billing_address.rb
118
118
  - lib/shopify_api/resources/blog.rb
119
119
  - lib/shopify_api/resources/cart.rb
120
+ - lib/shopify_api/resources/checkout.rb
120
121
  - lib/shopify_api/resources/collect.rb
121
122
  - lib/shopify_api/resources/comment.rb
122
123
  - lib/shopify_api/resources/country.rb