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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDYxYTVjZmQ0NGNlMTRhNjUwMmEwNTNiYThkODc2NTVhOTg5OTU5OQ==
4
+ MDUzZjI3NjBlMTlhMjAxYjAxZmJlZGM1MGNlOGUxMWUzNTNjNDJhMw==
5
5
  data.tar.gz: !binary |-
6
- NjUzNjVhNzE0ODAzZTk4NzIzNTJiNjI5NjBkOGVjY2FmYjMzMDk3Mw==
6
+ ZTViZTk1NGE4ODRhYmMyYTBhMjIzMzUwZTAyNDBkOTQyZTEwNTFjMQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTE3MGUxZGRiMjg2Njg0NTIxZWE0MGUzMzczMmI4N2M4YzJjNDFmY2UxOWM4
10
- NWNmMzgxYTkzZGNhN2QzNTYwNzQ0MTQ2MzAyMTdmZDA3ODU0MDBkMjFhYTJl
11
- ZWRmNTliZjQxNzhmYThhNmM2MjliOWM5Zjc1M2RlNTM1NTU3NGY=
9
+ NmRkOTM4NzM5ODIxNjZmZjAxMmRhNGJmYWVmOWIxNjljOWZiYzg4YTgwYTQw
10
+ YjY4ZTRkZDc2Y2NkMWJmMjY1MTQ1NjhiZmZhYWQxNjgxNDRkYmY2ZDQ5Yjg5
11
+ NGNjMTAxODI3MGUxYTUzM2U3OGMzNzNmNWFhZDg5YTYwNmMxZDM=
12
12
  data.tar.gz: !binary |-
13
- ODA4ODM4YzY5NzFlZDQzMTFiMWQ3YThmYjA4MTc0NTk2YjMyZmU1MTRlZTU3
14
- NDUzOTZjZjZmZGI3NzM5Njc2NzU0OTczNTlhNjhjNWMwMzU5MDdkYTQ1NzMx
15
- ZGI3YTExMWNjMDFmMTczOTNkZWMwYTE1NGMyYzBhMTNhNTVlMTQ=
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.11)
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.1)
12
- activesupport (= 4.2.1)
11
+ activemodel (4.2.7)
12
+ activesupport (= 4.2.7)
13
13
  builder (~> 3.1)
14
- activeresource (4.0.0)
14
+ activeresource (4.1.0)
15
15
  activemodel (~> 4.0)
16
16
  activesupport (~> 4.0)
17
- rails-observers (~> 0.1.1)
18
- activesupport (4.2.1)
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.2)
29
+ json (1.8.3)
30
30
  metaclass (0.0.1)
31
31
  method_source (0.8.2)
32
- minitest (5.5.1)
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
@@ -19,5 +19,6 @@ end
19
19
  require "versacommerce_api/associatable"
20
20
  require "versacommerce_api/version"
21
21
  require 'versacommerce_api/countable'
22
+ require 'versacommerce_api/metafieldable'
22
23
  require 'versacommerce_api/resources'
23
24
  require 'versacommerce_api/session'
@@ -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
@@ -0,0 +1,8 @@
1
+ # -*- encoding : utf-8 -*-
2
+ module VersacommerceAPI
3
+
4
+ class Blog < Base
5
+ include Metafieldable
6
+ end
7
+
8
+ end
@@ -2,6 +2,7 @@
2
2
  module VersacommerceAPI
3
3
 
4
4
  class Collection < Base
5
+ include Metafieldable
5
6
  end
6
-
7
+
7
8
  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
@@ -0,0 +1,11 @@
1
+ # -*- encoding : utf-8 -*-
2
+ module VersacommerceAPI
3
+
4
+ class Metafield < Base
5
+ end
6
+
7
+ end
8
+
9
+
10
+
11
+ VersacommerceAPI::Base.site = 'http://api:8dcd299114bfee24dc76a9d56ca133c2e42c9d96@tobias-kuriose-antiquitaeten.dev:5000/api'
@@ -6,6 +6,7 @@ module VersacommerceAPI
6
6
  # VersaCommerceShopApi::Order.find(:all, :params => {:include => 'items', :limit => 10})
7
7
  class Order < Base
8
8
  include Associatable
9
+ include Metafieldable
9
10
 
10
11
  def items
11
12
  associated_resource "items"
@@ -2,6 +2,7 @@
2
2
  module VersacommerceAPI
3
3
 
4
4
  class Page < Base
5
+ include Metafieldable
5
6
  end
6
-
7
+
7
8
  end
@@ -3,6 +3,7 @@ module VersacommerceAPI
3
3
 
4
4
  class Product < Base
5
5
  include Associatable
6
+ include Metafieldable
6
7
 
7
8
  def initialize(attributes, persisted = false)
8
9
  super
@@ -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, :from => "/api/shop.xml")
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
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module VersacommerceAPI
3
- VERSION = '1.0.12'
3
+ VERSION = '1.0.14'
4
4
  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.12
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-02-17 00:00:00.000000000 Z
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