vhx-ruby 0.0.5 → 0.0.6

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: 774867e2ad6cdb31dd0775731347a14fcdfc28d4
4
- data.tar.gz: 701b1929e95e932605eb8e548ce09ecf6a884c38
3
+ metadata.gz: 69544b57dcaec324d5c1f1d4b440dd795b80e0bf
4
+ data.tar.gz: 51153d815eb91fca445ebae3fa2a86884a9af94f
5
5
  SHA512:
6
- metadata.gz: e89bb3b3393b34ec03e132f9ba59bcf15c2dad82394e00e5e303f42c039b1b375d0e0a8e1441ce5ed4f1a9df494406340145b34c22f8a5ea587f9feaea16e51d
7
- data.tar.gz: 764d0ba935f9659dbc16ef9cb819a61e3e3081b1fb0160fce3cd93f4f40e800d2387ad79b461c6b039a2f8b3401b04d30f70a016ef6f58e7496e93fee4cb06bc
6
+ metadata.gz: 0f16a0bd34c133757cbe354dc900eefa9c364c62af7e3880efe8ca13ed7c5253bb24e8d4b902562e9140ee6fa09010af7927587f968747de64633bbc6209e39f
7
+ data.tar.gz: e32b6a79c4f8d2aa979b60a84637dcbbf97c27a76befb7ca5ac8f172bde2007462fe304aaf13123725fc5d67b55f70dd340e8089fe214d841e3157744031cfd9
@@ -4,5 +4,23 @@ module Vhx
4
4
  include Vhx::ApiOperations::Request
5
5
  include Vhx::ApiOperations::List
6
6
  include Vhx::ApiOperations::Delete
7
+
8
+ def add_product(identifier)
9
+ response = Vhx.connection.put do |req|
10
+ req.url('/customers/' + self.id.to_s + '/products')
11
+ req.body = { product: get_hypermedia(identifier, 'Product') }
12
+ end
13
+
14
+ self.class.new(response.body)
15
+ end
16
+
17
+ def remove_product(identifier)
18
+ response = Vhx.connection.delete do |req|
19
+ req.url('/customers/' + self.id.to_s + '/products')
20
+ req.body = { product: get_hypermedia(identifier, 'Product') }
21
+ end
22
+
23
+ self.class.new(response.body)
24
+ end
7
25
  end
8
26
  end
@@ -8,6 +8,10 @@ module Vhx
8
8
  response = Vhx.connection.get('/' + get_klass.downcase + 's', payload)
9
9
  VhxListObject.new(response.body, get_klass.downcase + 's')
10
10
  end
11
+
12
+ def list(payload = {})
13
+ self.all(payload)
14
+ end
11
15
  end
12
16
 
13
17
  def self.included(klass)
@@ -6,6 +6,10 @@ module Vhx
6
6
  response = Vhx.connection.get(get_hypermedia(identifier))
7
7
  self.new(response.body)
8
8
  end
9
+
10
+ def retrieve(identifier)
11
+ self.find(identifier)
12
+ end
9
13
  end
10
14
 
11
15
  def self.included(klass)
@@ -31,6 +31,10 @@ module Vhx
31
31
  return OpenStruct.new(data)
32
32
  end
33
33
 
34
+ def _links
35
+ JSON.parse(@obj_hash['_links'].to_json, object_class: OpenStruct)
36
+ end
37
+
34
38
  protected
35
39
  def validate_class(obj_hash)
36
40
  return nil unless obj_hash['_links'].fetch('self', nil)
data/lib/vhx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vhx
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/vhx.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  spec.name = 'vhx-ruby'
7
7
  spec.version = Vhx::VERSION
8
8
  spec.authors = ['Sagar Shah']
9
- spec.date = '2016-01-14'
9
+ spec.date = '2016-02-16'
10
10
  spec.description = 'A Ruby wrapper for the Vhx developer API.'
11
11
  spec.summary = 'A Ruby wrapper for the Vhx developer API.'
12
12
  spec.email = ['sagar@vhx.tv', 'dev@vhx.tv', 'wontae@vhx.tv', 'charlie@vhx.tv', 'kevin@vhx.tv', 'scott@vhx.tv']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vhx-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sagar Shah
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-14 00:00:00.000000000 Z
11
+ date: 2016-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday