shopify_api 3.0.3 → 3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/CHANGELOG +9 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +48 -0
- data/README.rdoc +1 -1
- data/Rakefile +3 -2
- data/lib/shopify_api/json_format.rb +11 -32
- data/lib/shopify_api/resources/announcement.rb +4 -0
- data/lib/shopify_api/resources/article.rb +6 -1
- data/lib/shopify_api/resources/base.rb +17 -0
- data/lib/shopify_api/resources/customer.rb +3 -0
- data/lib/shopify_api/resources/customer_group.rb +3 -5
- data/lib/shopify_api/resources/customer_saved_search.rb +9 -0
- data/lib/shopify_api/resources/order.rb +3 -0
- data/lib/shopify_api/resources/smart_collection.rb +5 -0
- data/lib/shopify_api/session.rb +12 -1
- data/lib/shopify_api/version.rb +1 -1
- data/shopify_api.gemspec +2 -0
- data/test/article_test.rb +28 -0
- data/test/blog_test.rb +2 -2
- data/test/customer_saved_search_test.rb +27 -0
- data/test/detailed_log_subscriber_test.rb +1 -0
- data/test/fixtures/article.json +15 -0
- data/test/fixtures/articles.json +39 -0
- data/test/fixtures/blog.json +13 -0
- data/test/fixtures/blogs.json +2 -2
- data/test/fixtures/customer_saved_search.json +9 -0
- data/test/fixtures/customer_saved_search_customers.json +60 -0
- data/test/session_test.rb +12 -0
- data/test/test_helper.rb +1 -0
- metadata +30 -15
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
Yjk3NThmNmE5YjE3NjgyNTBkNjQ0MmY0MDQ4MmJkN2YwZGMyZWU3MQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NDlhZjI5MGZmNTM0ZTlmOGE4ODY4YTFmYjQ5OTAyMGYxY2Y2NTBiOQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NjIzNTA3MmZkZTllOWJiMGZhYWI3NWYwZDliNWJiYTNlM2NhYTI0MDQ1MzQ5
|
10
|
+
MWYzZTRjNjM4NzJjNzliOWEzMGYzNTA1NmFkNGM0YjY2NDhhYjNiYzZkODNl
|
11
|
+
NDkzNzVjNjcxY2E2YmY1NzM3YjQxZmI0YzcwNmNlOWExNTRmZjg=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YjlkODc5YjJjNDg3Nzk0NzkyZWJmYzBiZDg1N2RhOTgwYzYzOTk0NDEwOGU3
|
14
|
+
ZTI5YjBkMDNkZjk5MjE3NjNhN2ZhNGE2ZGJmM2YxMGE2YzRiOTA0N2JlYmZk
|
15
|
+
YzAzZWZkM2E2ZTYwYzQ2ZjVlYWNmMDdhMDRhNzk5ZDBlZWM0ZDY=
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== Version 3.1.2
|
2
|
+
|
3
|
+
* Includes port in domain URI (when other than http/80 or https/443)
|
4
|
+
* Adds access to CustomerSavedSearch
|
5
|
+
* Adds resources: Order::DefaultAddress, Client::ClientDetails, Announcement
|
6
|
+
* Allows access to Articles without a blog_id
|
7
|
+
* Moves encode and as_json overrides to ShopifyAPI::Base scope
|
8
|
+
* Exposes the `order` action in SmartCollection for general use
|
9
|
+
|
1
10
|
== Version 3.0.3
|
2
11
|
|
3
12
|
* Add a `customers` helper method to the CustomerGroup resource
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
shopify_api (3.1.2)
|
5
|
+
activeresource (>= 3.0.0)
|
6
|
+
thor (>= 0.14.4)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activemodel (4.0.0)
|
12
|
+
activesupport (= 4.0.0)
|
13
|
+
builder (~> 3.1.0)
|
14
|
+
activeresource (4.0.0)
|
15
|
+
activemodel (~> 4.0)
|
16
|
+
activesupport (~> 4.0)
|
17
|
+
rails-observers (~> 0.1.1)
|
18
|
+
activesupport (4.0.0)
|
19
|
+
i18n (~> 0.6, >= 0.6.4)
|
20
|
+
minitest (~> 4.2)
|
21
|
+
multi_json (~> 1.3)
|
22
|
+
thread_safe (~> 0.1)
|
23
|
+
tzinfo (~> 0.3.37)
|
24
|
+
atomic (1.1.14)
|
25
|
+
builder (3.1.4)
|
26
|
+
fakeweb (1.3.0)
|
27
|
+
i18n (0.6.5)
|
28
|
+
metaclass (0.0.1)
|
29
|
+
minitest (4.7.5)
|
30
|
+
mocha (0.14.0)
|
31
|
+
metaclass (~> 0.0.1)
|
32
|
+
multi_json (1.8.2)
|
33
|
+
rails-observers (0.1.2)
|
34
|
+
activemodel (~> 4.0)
|
35
|
+
rake (10.1.0)
|
36
|
+
thor (0.18.1)
|
37
|
+
thread_safe (0.1.3)
|
38
|
+
atomic
|
39
|
+
tzinfo (0.3.38)
|
40
|
+
|
41
|
+
PLATFORMS
|
42
|
+
ruby
|
43
|
+
|
44
|
+
DEPENDENCIES
|
45
|
+
fakeweb
|
46
|
+
mocha (>= 0.9.8)
|
47
|
+
rake
|
48
|
+
shopify_api!
|
data/README.rdoc
CHANGED
@@ -77,7 +77,7 @@ http://api.shopify.com <= Read the tech docs!
|
|
77
77
|
|
78
78
|
http://wiki.shopify.com/Developer_Home <= Read the wiki!
|
79
79
|
|
80
|
-
http://
|
80
|
+
http://ecommerce.shopify.com/c/shopify-apis-and-technology <= Ask questions on the forums!
|
81
81
|
|
82
82
|
== Copyright
|
83
83
|
|
data/Rakefile
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
require 'rubygems'
|
3
3
|
require 'rake'
|
4
|
+
require "bundler/gem_tasks"
|
4
5
|
|
5
6
|
require 'rake/testtask'
|
6
7
|
Rake::TestTask.new(:test) do |test|
|
@@ -25,7 +26,7 @@ end
|
|
25
26
|
|
26
27
|
task :default => :test
|
27
28
|
|
28
|
-
require '
|
29
|
+
require 'rdoc/task'
|
29
30
|
Rake::RDocTask.new do |rdoc|
|
30
31
|
if File.exist?('VERSION.yml')
|
31
32
|
config = YAML.load(File.read('VERSION.yml'))
|
@@ -38,4 +39,4 @@ Rake::RDocTask.new do |rdoc|
|
|
38
39
|
rdoc.title = "shopify_api #{version}"
|
39
40
|
rdoc.rdoc_files.include('README*')
|
40
41
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
41
|
-
end
|
42
|
+
end
|
@@ -1,37 +1,16 @@
|
|
1
1
|
module ActiveResource
|
2
|
-
class Base
|
3
|
-
def encode(options = {})
|
4
|
-
same = dup
|
5
|
-
same.attributes = {self.class.element_name => same.attributes} if self.class.format.extension == 'json'
|
6
|
-
|
7
|
-
same.send("to_#{self.class.format.extension}", options)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
module Formats
|
12
|
-
module JsonFormat
|
13
|
-
def decode(json)
|
14
|
-
data = ActiveSupport::JSON.decode(json)
|
15
|
-
if data.is_a?(Hash) && data.keys.size == 1
|
16
|
-
data.values.first
|
17
|
-
else
|
18
|
-
data
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
2
|
|
25
|
-
|
26
|
-
|
27
|
-
module
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
3
|
+
# ActiveResource 3.1 removes root on decoding, so this patch is only needed in 3.0
|
4
|
+
if ActiveResource::VERSION::MAJOR == 3 && ActiveResource::VERSION::MINOR == 0
|
5
|
+
module Formats
|
6
|
+
module JsonFormat
|
7
|
+
def decode(json)
|
8
|
+
data = ActiveSupport::JSON.decode(json)
|
9
|
+
if data.is_a?(Hash) && data.keys.size == 1
|
10
|
+
data.values.first
|
11
|
+
else
|
12
|
+
data
|
13
|
+
end
|
35
14
|
end
|
36
15
|
end
|
37
16
|
end
|
@@ -2,9 +2,14 @@ module ShopifyAPI
|
|
2
2
|
class Article < Base
|
3
3
|
include Events
|
4
4
|
include Metafields
|
5
|
+
include DisablePrefixCheck
|
5
6
|
|
6
7
|
self.prefix = "/admin/blogs/:blog_id/"
|
7
|
-
|
8
|
+
|
9
|
+
def self.prefix(options={})
|
10
|
+
options[:blog_id].nil? ? "/admin/" : "/admin/blogs/#{options[:blog_id]}/"
|
11
|
+
end
|
12
|
+
|
8
13
|
def comments
|
9
14
|
Comment.find(:all, :params => { :article_id => id })
|
10
15
|
end
|
@@ -8,6 +8,23 @@ module ShopifyAPI
|
|
8
8
|
"ActiveResource/#{ActiveResource::VERSION::STRING}",
|
9
9
|
"Ruby/#{RUBY_VERSION}"].join(' ')
|
10
10
|
|
11
|
+
def encode(options = {})
|
12
|
+
same = dup
|
13
|
+
same.attributes = {self.class.element_name => same.attributes} if self.class.format.extension == 'json'
|
14
|
+
|
15
|
+
same.send("to_#{self.class.format.extension}", options)
|
16
|
+
end
|
17
|
+
|
18
|
+
def as_json(options = nil)
|
19
|
+
root = options[:root] if options.try(:key?, :root)
|
20
|
+
if include_root_in_json
|
21
|
+
root = self.class.model_name.element if root == true
|
22
|
+
{ root => serializable_hash(options) }
|
23
|
+
else
|
24
|
+
serializable_hash(options)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
11
28
|
class << self
|
12
29
|
def headers
|
13
30
|
if defined?(@headers)
|
data/lib/shopify_api/session.rb
CHANGED
@@ -18,7 +18,7 @@ module ShopifyAPI
|
|
18
18
|
def temp(domain, token, &block)
|
19
19
|
session = new(domain, token)
|
20
20
|
begin
|
21
|
-
original_domain
|
21
|
+
original_domain = host_with_port(ShopifyAPI::Base.site.to_s)
|
22
22
|
rescue URI::InvalidURIError
|
23
23
|
end
|
24
24
|
original_token = ShopifyAPI::Base.headers['X-Shopify-Access-Token']
|
@@ -45,6 +45,17 @@ module ShopifyAPI
|
|
45
45
|
Digest::MD5.hexdigest(secret + sorted_params) == signature
|
46
46
|
end
|
47
47
|
|
48
|
+
def host_with_port(site)
|
49
|
+
parsed_site = URI.parse(site)
|
50
|
+
host = parsed_site.host or return
|
51
|
+
port = parsed_site.port
|
52
|
+
if (protocol == 'http' && port == 80) || (protocol == 'https' && port == 443)
|
53
|
+
host
|
54
|
+
else
|
55
|
+
"#{host}:#{port}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
48
59
|
end
|
49
60
|
|
50
61
|
def initialize(url, token = nil, params = nil)
|
data/lib/shopify_api/version.rb
CHANGED
data/shopify_api.gemspec
CHANGED
@@ -30,8 +30,10 @@ Gem::Specification.new do |s|
|
|
30
30
|
if s.respond_to?(:add_development_dependency)
|
31
31
|
s.add_development_dependency("mocha", ">= 0.9.8")
|
32
32
|
s.add_development_dependency("fakeweb")
|
33
|
+
s.add_development_dependency("rake")
|
33
34
|
else
|
34
35
|
s.add_dependency("mocha", ">= 0.9.8")
|
35
36
|
s.add_dependency("fakeweb")
|
37
|
+
s.add_dependency("rake")
|
36
38
|
end
|
37
39
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ArticleTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_get_article
|
6
|
+
fake "articles/6242736", :method => :get, :body => load_fixture('article')
|
7
|
+
article = ShopifyAPI::Article.find(6242736)
|
8
|
+
assert_equal "First Post", article.title
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_get_articles
|
12
|
+
fake "articles", :method => :get, :body => load_fixture('articles')
|
13
|
+
articles = ShopifyAPI::Article.all
|
14
|
+
assert_equal 3, articles.length
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_get_articles_namespaced
|
18
|
+
fake "blogs/1008414260/articles", :method => :get, :body => load_fixture('articles')
|
19
|
+
articles = ShopifyAPI::Article.find(:all, :params => {:blog_id => 1008414260})
|
20
|
+
assert_equal 3, articles.length
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_get_article_namespaced
|
24
|
+
fake "blogs/1008414260/articles/6242736", :method => :get, :body => load_fixture('article')
|
25
|
+
article = ShopifyAPI::Article.find(6242736, :params => {:blog_id => 1008414260})
|
26
|
+
assert_equal "First Post", article.title
|
27
|
+
end
|
28
|
+
end
|
data/test/blog_test.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
class BlogTest < Test::Unit::TestCase
|
3
3
|
test "blog creation" do
|
4
|
-
fake "blogs", :method => :post, :status => 202
|
5
|
-
ShopifyAPI::Blog.create(:title => "Test Blog")
|
4
|
+
fake "blogs", :method => :post, :status => 202, :body => load_fixture('blog')
|
5
|
+
blog = ShopifyAPI::Blog.create(:title => "Test Blog")
|
6
6
|
assert_equal '{"blog":{"title":"Test Blog"}}', FakeWeb.last_request.body
|
7
7
|
end
|
8
8
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class CustomerSavedSearchTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
super
|
6
|
+
load_customer_saved_search
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_get_customers_from_customer_saved_search
|
10
|
+
fake 'customers.json?customer_saved_search_id=8899730', :body => load_fixture('customer_saved_search_customers'), :extension => false
|
11
|
+
assert_equal 1, @customer_saved_search.customers.length
|
12
|
+
assert_equal 112223902, @customer_saved_search.customers.first.id
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_get_customers_from_customer_saved_search_with_params
|
16
|
+
fake 'customers.json?customer_saved_search_id=8899730&limit=1', :body => load_fixture('customer_saved_search_customers'), :extension => false
|
17
|
+
customers = @customer_saved_search.customers(:limit => 1)
|
18
|
+
assert_equal 1, customers.length
|
19
|
+
assert_equal 112223902, customers.first.id
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
def load_customer_saved_search
|
24
|
+
fake 'customer_saved_searches/8899730', :body => load_fixture('customer_saved_search')
|
25
|
+
@customer_saved_search = ShopifyAPI::CustomerSavedSearch.find(8899730)
|
26
|
+
end
|
27
|
+
end
|
@@ -9,6 +9,7 @@ class LogSubscriberTest < Test::Unit::TestCase
|
|
9
9
|
@page = { :page => { :id => 1, :title => 'Shopify API' } }.to_json
|
10
10
|
@ua_header = "\"User-Agent\"=>\"ShopifyAPI/#{ShopifyAPI::VERSION} ActiveResource/#{ActiveResource::VERSION::STRING} Ruby/#{RUBY_VERSION}\""
|
11
11
|
|
12
|
+
ShopifyAPI::Base.clear_session
|
12
13
|
ShopifyAPI::Base.site = "http://localhost/admin"
|
13
14
|
|
14
15
|
ActiveResource::LogSubscriber.attach_to :active_resource
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"article": {
|
3
|
+
"author": "Shopify",
|
4
|
+
"blog_id": 1008414260,
|
5
|
+
"body_html": null,
|
6
|
+
"created_at": "2012-07-06T13:57:28-04:00",
|
7
|
+
"id": 6242736,
|
8
|
+
"published_at": "2012-07-06T13:57:28-04:00",
|
9
|
+
"summary_html": null,
|
10
|
+
"title": "First Post",
|
11
|
+
"updated_at": "2012-07-06T13:57:51-04:00",
|
12
|
+
"user_id": null,
|
13
|
+
"tags": "consequuntur, cupiditate, repellendus"
|
14
|
+
}
|
15
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
{
|
2
|
+
"articles": [{
|
3
|
+
"author": "Shopify",
|
4
|
+
"blog_id": 1008414260,
|
5
|
+
"body_html": null,
|
6
|
+
"created_at": "2012-07-06T13:57:28-04:00",
|
7
|
+
"id": 6242736,
|
8
|
+
"published_at": "2012-07-06T13:57:28-04:00",
|
9
|
+
"summary_html": null,
|
10
|
+
"title": "First Post",
|
11
|
+
"updated_at": "2012-07-06T13:57:51-04:00",
|
12
|
+
"user_id": null,
|
13
|
+
"tags": "consequuntur, cupiditate, repellendus"
|
14
|
+
}, {
|
15
|
+
"author": "development shop",
|
16
|
+
"blog_id": 1008414260,
|
17
|
+
"body_html": null,
|
18
|
+
"created_at": "2013-04-21T18:10:35-04:00",
|
19
|
+
"id": 7739673,
|
20
|
+
"published_at": "2013-04-21T18:10:22-04:00",
|
21
|
+
"summary_html": null,
|
22
|
+
"title": "My second blog post",
|
23
|
+
"updated_at": "2013-04-21T18:10:35-04:00",
|
24
|
+
"user_id": 2221540,
|
25
|
+
"tags": ""
|
26
|
+
}, {
|
27
|
+
"author": "development shop",
|
28
|
+
"blog_id": 1008414260,
|
29
|
+
"body_html": null,
|
30
|
+
"created_at": "2013-04-21T18:11:19-04:00",
|
31
|
+
"id": 7739683,
|
32
|
+
"published_at": "2013-04-21T18:10:45-04:00",
|
33
|
+
"summary_html": null,
|
34
|
+
"title": "50% off sale",
|
35
|
+
"updated_at": "2013-04-21T18:11:19-04:00",
|
36
|
+
"user_id": 2221540,
|
37
|
+
"tags": ""
|
38
|
+
}]
|
39
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"blog": {
|
3
|
+
"handle": "test-blog",
|
4
|
+
"created_at": "2012-01-10T17:45:19-05:00",
|
5
|
+
"title": "Test Blog",
|
6
|
+
"template_suffix": null,
|
7
|
+
"updated_at": "2012-01-10T17:45:19-05:00",
|
8
|
+
"feedburner_location": null,
|
9
|
+
"id": 1008414260,
|
10
|
+
"feedburner": null,
|
11
|
+
"commentable": "no"
|
12
|
+
}
|
13
|
+
}
|
data/test/fixtures/blogs.json
CHANGED
@@ -0,0 +1,60 @@
|
|
1
|
+
{
|
2
|
+
"customers": [
|
3
|
+
{
|
4
|
+
"accepts_marketing": true,
|
5
|
+
"created_at": "2013-01-29T16:33:35-05:00",
|
6
|
+
"email": "john.smith@gmail.com",
|
7
|
+
"first_name": "John",
|
8
|
+
"id": 112223902,
|
9
|
+
"last_name": "Smith",
|
10
|
+
"last_order_id": null,
|
11
|
+
"multipass_identifier": null,
|
12
|
+
"note": "This is sample note",
|
13
|
+
"orders_count": 0,
|
14
|
+
"state": "disabled",
|
15
|
+
"total_spent": "0.00",
|
16
|
+
"updated_at": "2013-03-05T17:00:05-05:00",
|
17
|
+
"verified_email": true,
|
18
|
+
"tags": "Buyer, Canadian",
|
19
|
+
"last_order_name": null,
|
20
|
+
"default_address": {
|
21
|
+
"address1": "1234 Simple Road",
|
22
|
+
"address2": null,
|
23
|
+
"city": "Ottawa",
|
24
|
+
"company": null,
|
25
|
+
"country": "Canada",
|
26
|
+
"first_name": "John",
|
27
|
+
"id": 152583148,
|
28
|
+
"last_name": "Smith",
|
29
|
+
"phone": "555-555-5555",
|
30
|
+
"province": "Ontario",
|
31
|
+
"zip": "K2H 0A0",
|
32
|
+
"name": "John Smith",
|
33
|
+
"province_code": "ON",
|
34
|
+
"country_code": "CA",
|
35
|
+
"country_name": "Canada",
|
36
|
+
"default": true
|
37
|
+
},
|
38
|
+
"addresses": [
|
39
|
+
{
|
40
|
+
"address1": "1234 Simple Road",
|
41
|
+
"address2": null,
|
42
|
+
"city": "Ottawa",
|
43
|
+
"company": null,
|
44
|
+
"country": "Canada",
|
45
|
+
"first_name": "John",
|
46
|
+
"id": 152583148,
|
47
|
+
"last_name": "Smith",
|
48
|
+
"phone": "555-555-5555",
|
49
|
+
"province": "Ontario",
|
50
|
+
"zip": "K2H 0A0",
|
51
|
+
"name": "John Smith",
|
52
|
+
"province_code": "ON",
|
53
|
+
"country_code": "CA",
|
54
|
+
"country_name": "Canada",
|
55
|
+
"default": true
|
56
|
+
}
|
57
|
+
]
|
58
|
+
}
|
59
|
+
]
|
60
|
+
}
|
data/test/session_test.rb
CHANGED
@@ -53,6 +53,18 @@ class SessionTest < Test::Unit::TestCase
|
|
53
53
|
assert_equal 'https://fakeshop.myshopify.com/admin', ShopifyAPI::Base.site.to_s
|
54
54
|
end
|
55
55
|
|
56
|
+
should "#temp reset ShopifyAPI::Base.site to original value when using a non-standard port" do
|
57
|
+
ShopifyAPI::Session.setup(:api_key => "key", :secret => "secret")
|
58
|
+
session1 = ShopifyAPI::Session.new('fakeshop.myshopify.com:3000', 'token1')
|
59
|
+
ShopifyAPI::Base.activate_session(session1)
|
60
|
+
|
61
|
+
ShopifyAPI::Session.temp("testshop.myshopify.com", "any-token") {
|
62
|
+
@assigned_site = ShopifyAPI::Base.site
|
63
|
+
}
|
64
|
+
assert_equal 'https://testshop.myshopify.com/admin', @assigned_site.to_s
|
65
|
+
assert_equal 'https://fakeshop.myshopify.com:3000/admin', ShopifyAPI::Base.site.to_s
|
66
|
+
end
|
67
|
+
|
56
68
|
should "return site for session" do
|
57
69
|
session = ShopifyAPI::Session.new("testshop.myshopify.com", "any-token")
|
58
70
|
assert_equal "https://testshop.myshopify.com/admin", session.site
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
5
|
-
prerelease:
|
4
|
+
version: 3.1.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Shopify
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-10-29 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activeresource
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ! '>='
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: thor
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: mocha
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: fakeweb
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ! '>='
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,20 @@ dependencies:
|
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
79
|
requirements:
|
75
80
|
- - ! '>='
|
76
81
|
- !ruby/object:Gem::Version
|
@@ -91,6 +96,8 @@ files:
|
|
91
96
|
- .gitignore
|
92
97
|
- CHANGELOG
|
93
98
|
- CONTRIBUTORS
|
99
|
+
- Gemfile
|
100
|
+
- Gemfile.lock
|
94
101
|
- LICENSE
|
95
102
|
- README.rdoc
|
96
103
|
- RELEASING
|
@@ -110,6 +117,7 @@ files:
|
|
110
117
|
- lib/shopify_api/metafields.rb
|
111
118
|
- lib/shopify_api/resources.rb
|
112
119
|
- lib/shopify_api/resources/address.rb
|
120
|
+
- lib/shopify_api/resources/announcement.rb
|
113
121
|
- lib/shopify_api/resources/application_charge.rb
|
114
122
|
- lib/shopify_api/resources/article.rb
|
115
123
|
- lib/shopify_api/resources/asset.rb
|
@@ -124,6 +132,7 @@ files:
|
|
124
132
|
- lib/shopify_api/resources/custom_collection.rb
|
125
133
|
- lib/shopify_api/resources/customer.rb
|
126
134
|
- lib/shopify_api/resources/customer_group.rb
|
135
|
+
- lib/shopify_api/resources/customer_saved_search.rb
|
127
136
|
- lib/shopify_api/resources/event.rb
|
128
137
|
- lib/shopify_api/resources/fulfillment.rb
|
129
138
|
- lib/shopify_api/resources/image.rb
|
@@ -154,16 +163,23 @@ files:
|
|
154
163
|
- lib/shopify_api/session.rb
|
155
164
|
- lib/shopify_api/version.rb
|
156
165
|
- shopify_api.gemspec
|
166
|
+
- test/article_test.rb
|
157
167
|
- test/asset_test.rb
|
158
168
|
- test/base_test.rb
|
159
169
|
- test/blog_test.rb
|
160
170
|
- test/cart_test.rb
|
161
171
|
- test/cli_test.rb
|
172
|
+
- test/customer_saved_search_test.rb
|
162
173
|
- test/detailed_log_subscriber_test.rb
|
174
|
+
- test/fixtures/article.json
|
175
|
+
- test/fixtures/articles.json
|
163
176
|
- test/fixtures/asset.json
|
164
177
|
- test/fixtures/assets.json
|
178
|
+
- test/fixtures/blog.json
|
165
179
|
- test/fixtures/blogs.json
|
166
180
|
- test/fixtures/carts.json
|
181
|
+
- test/fixtures/customer_saved_search.json
|
182
|
+
- test/fixtures/customer_saved_search_customers.json
|
167
183
|
- test/fixtures/events.json
|
168
184
|
- test/fixtures/metafield.json
|
169
185
|
- test/fixtures/metafields.json
|
@@ -181,28 +197,27 @@ files:
|
|
181
197
|
homepage: http://www.shopify.com/partners/apps
|
182
198
|
licenses:
|
183
199
|
- MIT
|
200
|
+
metadata: {}
|
184
201
|
post_install_message:
|
185
202
|
rdoc_options:
|
186
203
|
- --charset=UTF-8
|
187
204
|
require_paths:
|
188
205
|
- lib
|
189
206
|
required_ruby_version: !ruby/object:Gem::Requirement
|
190
|
-
none: false
|
191
207
|
requirements:
|
192
208
|
- - ! '>='
|
193
209
|
- !ruby/object:Gem::Version
|
194
210
|
version: '0'
|
195
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
|
-
none: false
|
197
212
|
requirements:
|
198
213
|
- - ! '>='
|
199
214
|
- !ruby/object:Gem::Version
|
200
215
|
version: '0'
|
201
216
|
requirements: []
|
202
217
|
rubyforge_project:
|
203
|
-
rubygems_version: 1.
|
218
|
+
rubygems_version: 2.1.5
|
204
219
|
signing_key:
|
205
|
-
specification_version:
|
220
|
+
specification_version: 4
|
206
221
|
summary: ShopifyAPI is a lightweight gem for accessing the Shopify admin REST web
|
207
222
|
services
|
208
223
|
test_files: []
|