veeqo_api_ruby 0.1.1 → 0.1.2

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: 9d89f532e9a482385d86d41f4a42a9ca9064bc49
4
- data.tar.gz: b5abe9360c21f2a23de53e449c997fbe286285b3
3
+ metadata.gz: 0c3c8de73b79df709358f08e906590b37858d96a
4
+ data.tar.gz: bd0dbac717a64b25504fa9901e4e68f11a026f8c
5
5
  SHA512:
6
- metadata.gz: 3a27ae249ad58cac59c3a95675ca7d1de8449c093f7884b8528f2e357f365cb7327119527d868b24a8aaa2c8436521fb31abec4703c3d5d0ba36d719af296e2e
7
- data.tar.gz: d8b04a6402367408da4c740114c39c5b4f208980001b2e21506f6a1de85823e5b2997cf4612007d0b8df79a974ae56dca3833080427813ab0ff3f4b5cdfe44e8
6
+ metadata.gz: 2163527e0c245fe0c88113dee2213d76a16707abaf372b2de970cfa604651c83d272f3cabd89d068caca574c95095cedd8ad389a3879b22a0bb8369af0f0612d
7
+ data.tar.gz: 1a3e0b7bc84b5845db6f4351adb828fdd0459214714aa438ab8d95c27d64613cf76eb857e24d5cd7658b7d96e5fa735bc01780d8a8946f316797e4414e4a56cf
data/README.md CHANGED
@@ -1,9 +1,5 @@
1
1
  # VeeqoApiRuby
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/veeqo_api_ruby`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
3
  ## Installation
8
4
 
9
5
  Add this line to your application's Gemfile:
@@ -36,6 +32,23 @@ end
36
32
  Veeqo::Company.info
37
33
  => #<Veeqo::Company id=1234>
38
34
  ```
35
+ ### Thread Safety
36
+
37
+ The `Veeqo.configure` method is NOT thread-safe. This mechanism is designed for applications or CLI's (command-line interfaces) where thread safety is not a concern. If you need to guarantee thread safety, we support this alternative mechanism to make thread-safe API requests:
38
+
39
+ Rather then setting up a single `connection` for all API requests, you would construct a new connection for each thread. If you can ensure that each of these connections is stored in a thread-safe manner, you can pass the `connection` as you query the resource.
40
+
41
+ ```rb
42
+ connection = Veeqo::Connection.build(
43
+ Veeqo::Config.new(
44
+ api_key: ENV['VEEQO_API_KEY']
45
+ )
46
+ )
47
+ => #<Faraday::Connection:0x007fbf95068978 ... >>
48
+
49
+ Veeqo::Company.info(connection: connection)
50
+ => #<Veeqo::Company id=1234>
51
+ ```
39
52
 
40
53
 
41
54
  ## Development
@@ -47,5 +47,12 @@ module Veeqo
47
47
  property :total_tax
48
48
  property :updated_at
49
49
  property :updated_by
50
+
51
+ def self.destroy(resource_id, params = {})
52
+ raise ArgumentError if resource_id.nil?
53
+ delete path.build(resource_id), params
54
+ rescue Veeqo::NotFound
55
+ nil
56
+ end
50
57
  end
51
58
  end
@@ -4,7 +4,7 @@
4
4
 
5
5
  module Veeqo
6
6
  class Supplier < Resource
7
- include Veeqo::ResourceActions.new(uri: 'suppliers/%d', disable: [:find, :destroy, :destroy_all])
7
+ include Veeqo::ResourceActions.new(uri: 'suppliers/%d', disable: [:find, :create, :destroy, :destroy_all])
8
8
 
9
9
  property :id
10
10
  property :name
@@ -31,5 +31,18 @@ module Veeqo
31
31
  property :bank_account_number
32
32
  property :bank_sort_code
33
33
  property :bank_name
34
+
35
+ def self.create(params = {})
36
+ post path.build, params
37
+ rescue Veeqo::NotAccepted
38
+ nil
39
+ end
40
+
41
+ def self.update(resource_id, params = {})
42
+ raise ArgumentError if resource_id.nil?
43
+ put path.build(resource_id), params
44
+ rescue Veeqo::NotAccepted
45
+ nil
46
+ end
34
47
  end
35
48
  end
data/lib/veeqo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Veeqo
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: veeqo_api_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yurkiv Misha
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-17 00:00:00.000000000 Z
11
+ date: 2016-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler