versacommerce_api 1.0.12 → 1.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile.lock +11 -8
- data/lib/versacommerce_api.rb +1 -0
- data/lib/versacommerce_api/metafieldable.rb +24 -0
- data/lib/versacommerce_api/resources/blog.rb +8 -0
- data/lib/versacommerce_api/resources/collection.rb +2 -1
- data/lib/versacommerce_api/resources/customer.rb +3 -2
- data/lib/versacommerce_api/resources/metafield.rb +11 -0
- data/lib/versacommerce_api/resources/order.rb +1 -0
- data/lib/versacommerce_api/resources/page.rb +2 -1
- data/lib/versacommerce_api/resources/product.rb +1 -0
- data/lib/versacommerce_api/resources/shop.rb +15 -3
- data/lib/versacommerce_api/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDUzZjI3NjBlMTlhMjAxYjAxZmJlZGM1MGNlOGUxMWUzNTNjNDJhMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTViZTk1NGE4ODRhYmMyYTBhMjIzMzUwZTAyNDBkOTQyZTEwNTFjMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmRkOTM4NzM5ODIxNjZmZjAxMmRhNGJmYWVmOWIxNjljOWZiYzg4YTgwYTQw
|
10
|
+
YjY4ZTRkZDc2Y2NkMWJmMjY1MTQ1NjhiZmZhYWQxNjgxNDRkYmY2ZDQ5Yjg5
|
11
|
+
NGNjMTAxODI3MGUxYTUzM2U3OGMzNzNmNWFhZDg5YTYwNmMxZDM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTM5ZWM2ZThlMjg0OGE0YjcwNzYzMjA1NThmNjhhM2Q5YjAzZGRiMGIzODNi
|
14
|
+
NWU2OTVhMDk3ZGJjNDk3NTgzYzk3ZDI3MDg3MjM1ZGYxZTMxZTU3N2RkNWNj
|
15
|
+
ZjI4ZjdlNTQ0OGY1ZDc5YzRhNTJlNzg2YzQ4ZTZlNTMwMzA2NjE=
|
data/Gemfile.lock
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
versacommerce_api (1.0.
|
4
|
+
versacommerce_api (1.0.12)
|
5
5
|
activeresource (>= 3.2.14)
|
6
6
|
thor (>= 0.14.4)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (4.2.
|
12
|
-
activesupport (= 4.2.
|
11
|
+
activemodel (4.2.7)
|
12
|
+
activesupport (= 4.2.7)
|
13
13
|
builder (~> 3.1)
|
14
|
-
activeresource (4.
|
14
|
+
activeresource (4.1.0)
|
15
15
|
activemodel (~> 4.0)
|
16
16
|
activesupport (~> 4.0)
|
17
|
-
rails-observers (~> 0.1.
|
18
|
-
activesupport (4.2.
|
17
|
+
rails-observers (~> 0.1.2)
|
18
|
+
activesupport (4.2.7)
|
19
19
|
i18n (~> 0.7)
|
20
20
|
json (~> 1.7, >= 1.7.7)
|
21
21
|
minitest (~> 5.1)
|
@@ -26,10 +26,10 @@ GEM
|
|
26
26
|
diff-lcs (1.2.4)
|
27
27
|
fakeweb (1.3.0)
|
28
28
|
i18n (0.7.0)
|
29
|
-
json (1.8.
|
29
|
+
json (1.8.3)
|
30
30
|
metaclass (0.0.1)
|
31
31
|
method_source (0.8.2)
|
32
|
-
minitest (5.
|
32
|
+
minitest (5.9.0)
|
33
33
|
mocha (0.14.0)
|
34
34
|
metaclass (~> 0.0.1)
|
35
35
|
pry (0.9.12.2)
|
@@ -67,3 +67,6 @@ DEPENDENCIES
|
|
67
67
|
rake
|
68
68
|
rspec
|
69
69
|
versacommerce_api!
|
70
|
+
|
71
|
+
BUNDLED WITH
|
72
|
+
1.12.1
|
data/lib/versacommerce_api.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
module VersacommerceAPI
|
3
|
+
|
4
|
+
module Metafieldable
|
5
|
+
def metafields
|
6
|
+
if new_record?
|
7
|
+
[]
|
8
|
+
else
|
9
|
+
Metafield.find(:all, params: {metafieldable_type: self.class.collection_name.singularize.capitalize, metafieldable_id: id})
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def add_metafield(metafield)
|
14
|
+
raise ArgumentError, 'Adding Metafields to an unsaved Resource is not allowed' if new_record?
|
15
|
+
|
16
|
+
metafield.tap do |m|
|
17
|
+
m.metafieldable_type = self.class.collection_name.singularize.capitalize
|
18
|
+
m.metafieldable_type = id
|
19
|
+
|
20
|
+
m.save
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -3,7 +3,8 @@ module VersacommerceAPI
|
|
3
3
|
|
4
4
|
class Customer < Base
|
5
5
|
include Associatable
|
6
|
-
|
6
|
+
include Metafieldable
|
7
|
+
|
7
8
|
def billing_address
|
8
9
|
associated_resource "billing_address", false
|
9
10
|
end
|
@@ -12,5 +13,5 @@ module VersacommerceAPI
|
|
12
13
|
associated_resource "shipment_address", false
|
13
14
|
end
|
14
15
|
end
|
15
|
-
|
16
|
+
|
16
17
|
end
|
@@ -1,11 +1,23 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
module VersacommerceAPI
|
3
|
-
|
4
3
|
# Shop object. Use Shop.current to receive the shop.
|
5
4
|
class Shop < Base
|
5
|
+
include Metafieldable
|
6
|
+
|
7
|
+
def self.collection_name
|
8
|
+
'shop'
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.element_path(id, prefix_options = {}, query_options = nil)
|
12
|
+
"#{prefix(prefix_options)}#{collection_name}#{format_extension}#{query_string(query_options)}"
|
13
|
+
end
|
14
|
+
|
6
15
|
def self.current
|
7
|
-
find(:one, :
|
16
|
+
find(:one, from: '/api/shop.xml')
|
8
17
|
end
|
9
|
-
end
|
10
18
|
|
19
|
+
def to_xml(options = {})
|
20
|
+
super(only: [:current_design, :current_sandbox_design, :current_facebook_design])
|
21
|
+
end
|
22
|
+
end
|
11
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: versacommerce_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- VersaCommerce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -166,16 +166,19 @@ files:
|
|
166
166
|
- lib/versacommerce_api/associatable.rb
|
167
167
|
- lib/versacommerce_api/cli.rb
|
168
168
|
- lib/versacommerce_api/countable.rb
|
169
|
+
- lib/versacommerce_api/metafieldable.rb
|
169
170
|
- lib/versacommerce_api/resources.rb
|
170
171
|
- lib/versacommerce_api/resources/account.rb
|
171
172
|
- lib/versacommerce_api/resources/base.rb
|
172
173
|
- lib/versacommerce_api/resources/billing_address.rb
|
174
|
+
- lib/versacommerce_api/resources/blog.rb
|
173
175
|
- lib/versacommerce_api/resources/carrier.rb
|
174
176
|
- lib/versacommerce_api/resources/collection.rb
|
175
177
|
- lib/versacommerce_api/resources/customer.rb
|
176
178
|
- lib/versacommerce_api/resources/item.rb
|
177
179
|
- lib/versacommerce_api/resources/link.rb
|
178
180
|
- lib/versacommerce_api/resources/linklist.rb
|
181
|
+
- lib/versacommerce_api/resources/metafield.rb
|
179
182
|
- lib/versacommerce_api/resources/order.rb
|
180
183
|
- lib/versacommerce_api/resources/page.rb
|
181
184
|
- lib/versacommerce_api/resources/payment.rb
|