vhx-ruby 0.0.6 → 0.0.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69544b57dcaec324d5c1f1d4b440dd795b80e0bf
4
- data.tar.gz: 51153d815eb91fca445ebae3fa2a86884a9af94f
3
+ metadata.gz: a3fc113efc37f664b7f62505bdf410c86ae76cc4
4
+ data.tar.gz: 1b04aaa9fe91585a6c3be1e6feb3b6340d2a6ca1
5
5
  SHA512:
6
- metadata.gz: 0f16a0bd34c133757cbe354dc900eefa9c364c62af7e3880efe8ca13ed7c5253bb24e8d4b902562e9140ee6fa09010af7927587f968747de64633bbc6209e39f
7
- data.tar.gz: e32b6a79c4f8d2aa979b60a84637dcbbf97c27a76befb7ca5ac8f172bde2007462fe304aaf13123725fc5d67b55f70dd340e8089fe214d841e3157744031cfd9
6
+ metadata.gz: ae25bb65da0752a96c67c5ad311f49e7caa10c0fec85c0bd36d34699c4ce4ab0c05d55f2d86b2eb32c94986aa653196cedee138b0fbdbc151f53d2d6f3631692
7
+ data.tar.gz: b1282761cb591341d18d68c6de39d03ac4b4e3c09a80c1c281c4601bd0763ef9e24ab12b5eecc357c9db0cebe43eb2cc8ee857aaf19edbddf1346a0775cf5297
@@ -3,5 +3,9 @@ module Vhx
3
3
  include Vhx::ApiOperations::Create
4
4
  include Vhx::ApiOperations::Request
5
5
  include Vhx::ApiOperations::List
6
+
7
+ def files(payload = {})
8
+ fetch_linked_association(@obj_hash, "files", payload)
9
+ end
6
10
  end
7
11
  end
@@ -1,7 +1,7 @@
1
1
  module Vhx
2
2
  class VhxObject
3
3
  include HelperMethods
4
- ASSOCIATION_WHITELIST = ['products', 'sites', 'site', 'videos', 'video', 'subscription', 'files', 'items', 'customer']
4
+ ASSOCIATION_WHITELIST = ['products', 'sites', 'site', 'videos', 'video', 'subscription', 'items', 'customer']
5
5
 
6
6
  def initialize(obj_hash)
7
7
  @obj_hash = obj_hash
@@ -32,10 +32,15 @@ module Vhx
32
32
  end
33
33
 
34
34
  def _links
35
- JSON.parse(@obj_hash['_links'].to_json, object_class: OpenStruct)
35
+ JSON.parse(@obj_hash['_links'].to_json)
36
+ end
37
+
38
+ def _embedded
39
+ JSON.parse(@obj_hash['_embedded'].to_json)
36
40
  end
37
41
 
38
42
  protected
43
+
39
44
  def validate_class(obj_hash)
40
45
  return nil unless obj_hash['_links'].fetch('self', nil)
41
46
 
@@ -90,8 +95,7 @@ module Vhx
90
95
 
91
96
  def fetch_linked_association(obj_hash, association_method, payload = {})
92
97
  response = Vhx.connection.get do |req|
93
- req.url(obj_hash['_links'][association_method]['href'].gsub(Vhx.client.api_base_url, ""))
94
- req.body = payload
98
+ req.url(obj_hash['_links'][association_method]['href'].gsub(Vhx.client.api_base_url, "") + '?' + URI.encode_www_form(payload))
95
99
  end
96
100
 
97
101
  build_association(response.body, association_method)
@@ -1,3 +1,3 @@
1
1
  module Vhx
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vhx-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sagar Shah