coins_ph_ruby 0.2.0 → 0.2.1

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: b9be309c5c1e0fd598538f28d7ccac5ec2eb63f2
4
- data.tar.gz: 0fc80bb08bca7a18360ccdc44853e5bde7ed9da7
3
+ metadata.gz: 49be320ecca66bdd9181211adf884e804d81e0b9
4
+ data.tar.gz: 80fa7e3a7e6aa88b6ce10f2ea615cb77ce0df449
5
5
  SHA512:
6
- metadata.gz: c72e28dd5a63fe56e02c29f2c19ee62d4402ba711fc013ae8e8b111e3ef9f13e863f3c580083fe9f032ce989848b69216838560bd52c35db906b6784f1e1254b
7
- data.tar.gz: fc644bf8d699373e29d4b8af4878e44a2a1b04062265e4bfb9226c987979e687d1662d7015545cdd740bb48adfde79f2f6bd9cb2fb8f586b27046fe07f16b6d5
6
+ metadata.gz: 7e23eee938321d04e5e235c473e321a924e48a2248c6e6a43ed110d666f1e72634e22e67ffdf833e0d60c9b2372022c738a83a931730e0ca466a4d0ee1348ecf
7
+ data.tar.gz: 5a41d6f0f58decf0b646ef6f1ed7c9e3e878dabc8a9773769f2ff591f4ea18fc134d8aa5f47ae09e012de7f45e1a9fe12516669a0f403a37817896d3b0b46137
@@ -1,3 +1,3 @@
1
1
  module CoinsPhRuby
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/coins_ph_ruby.rb CHANGED
@@ -10,38 +10,26 @@ module CoinsPhRuby
10
10
  @base_url = 'https://coins.ph/api/v3'
11
11
  end
12
12
 
13
- def get_crypto_accounts(currency=nil)
13
+ def get_crypto_accounts(_currency = nil)
14
14
  nonce = Hmac.get_nonce
15
15
  url = @base_url + '/crypto-accounts/'
16
- signature = Hmac.sign_request(@api_secret, url,
17
- nonce)
18
- begin
19
- response = RestClient.get(url, content_type: :json,
20
- accept: :json,
21
- ACCESS_SIGNATURE: signature,
22
- ACCESS_KEY: @api_key,
23
- ACCESS_NONCE: nonce)
24
- rescue StandardError => e
25
- puts e.response
26
- end
27
- response
16
+ signature = Hmac.sign_request(@api_secret, url, nonce)
17
+ RestClient.get(url, content_type: :json,
18
+ accept: :json,
19
+ ACCESS_SIGNATURE: signature,
20
+ ACCESS_KEY: @api_key,
21
+ ACCESS_NONCE: nonce)
28
22
  end
29
23
 
30
24
  def get_transfers(_id = nil)
31
25
  nonce = Hmac.get_nonce
32
26
  url = @base_url + '/transfers/'
33
- signature = Hmac.sign_request(@api_secret, url,
34
- nonce)
35
- begin
36
- response = RestClient.get(url, content_type: :json,
37
- accept: :json,
38
- ACCESS_SIGNATURE: signature,
39
- ACCESS_KEY: @api_key,
40
- ACCESS_NONCE: nonce)
41
- rescue StandardError => e
42
- puts e.response
43
- end
44
- response
27
+ signature = Hmac.sign_request(@api_secret, url, nonce)
28
+ RestClient.get(url, content_type: :json,
29
+ accept: :json,
30
+ ACCESS_SIGNATURE: signature,
31
+ ACCESS_KEY: @api_key,
32
+ ACCESS_NONCE: nonce)
45
33
  end
46
34
 
47
35
  def transfer(amount, account, target_address, message = nil)
@@ -50,25 +38,20 @@ module CoinsPhRuby
50
38
  url = @base_url + '/transfers/'
51
39
  signature = Hmac.sign_request(@api_secret, url,
52
40
  nonce, body)
53
- begin
54
- response = RestClient.post(url, body, content_type: :json,
55
- accept: :json,
56
- ACCESS_SIGNATURE: signature,
57
- ACCESS_KEY: @api_key,
58
- ACCESS_NONCE: nonce)
59
- rescue StandardError => e
60
- puts e.response
61
- end
62
- response
41
+ RestClient.post(url, body, content_type: :json,
42
+ accept: :json,
43
+ ACCESS_SIGNATURE: signature,
44
+ ACCESS_KEY: @api_key,
45
+ ACCESS_NONCE: nonce)
63
46
  end
64
47
 
65
48
  private
66
49
 
67
50
  def build_transfer_body(account, amount, message, target_address)
68
51
  body = {
69
- target_address: target_address,
70
- account: account,
71
- amount: amount
52
+ target_address: target_address,
53
+ account: account,
54
+ amount: amount
72
55
  }
73
56
  body[:message] = message unless message.nil?
74
57
  body.to_json.gsub(/\s+/, '')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coins_ph_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jcdjulian