smartsend-ruby 0.0.3 → 0.1.0

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: 1daea641d267754bf37d492b13ece1a513f6225e
4
- data.tar.gz: 201cf9674744dbd1eb80118e310485814dbcc308
3
+ metadata.gz: dfa635f002d80cd3e9c99acf407f34ad6e309156
4
+ data.tar.gz: 8f09359296a9b5e9efb6f56ac6adbd71e9598bae
5
5
  SHA512:
6
- metadata.gz: 97a78073a953cee9b2b2719dbaaa91dff9dbc42a6c5a0c19a4dec070bc22f58cca68766ba8ec39414849fe207b4a6854e67223b84a156fe7aba5aac856c2637c
7
- data.tar.gz: a075eb79b103e433468a56d7db5bd6040ea5f47b0f1f023c1086367c2c5568e053d70957fb9e096bcdbef5587c86ae2dcd011aa51b4911867e1905c3705d95bf
6
+ metadata.gz: 426cc230bee3b8432be7bf81374ad5c44ea56015948b4204de698a0887962ac14eedb06ebcdeb8472095e314f7b1d7d19df4bad5352053813bec0e665b69a1f4
7
+ data.tar.gz: dc4b88417955b99438f78f4afa6af3a146127c8130a06586c37cab1d9dcb8d1786c25b81c26d48b9922de1f0654e614aa1e1ddfa0a9b5cf7c7fcb1ef61927b10
data/README.md CHANGED
@@ -172,3 +172,14 @@ account = Smartsend::Account.new(
172
172
 
173
173
  order.save!(account: account)
174
174
  ```
175
+
176
+ ### Validating account
177
+ ```ruby
178
+ account = Smartsend::Account.new(
179
+ email: 'wrong-username',
180
+ license: 'wrong-license-key'
181
+ )
182
+
183
+ account.valid?
184
+ => false
185
+ ```
@@ -6,4 +6,13 @@ class Smartsend::Account
6
6
  @license = license
7
7
  end
8
8
 
9
+ def valid?
10
+ begin
11
+ response = Smartsend::Client.new(self).get_plain('verify_user')
12
+ response.code.to_s == '200'
13
+ rescue Smartsend::AuthorizationError => e
14
+ false
15
+ end
16
+ end
17
+
9
18
  end
@@ -2,7 +2,7 @@ require 'http'
2
2
 
3
3
  class Smartsend::Client
4
4
 
5
- BASE_URL = 'http://smartsend-prod.apigee.net/v7/booking'.freeze
5
+ BASE_URL = 'http://smartsend-prod.apigee.net/v7'.freeze
6
6
 
7
7
  def initialize(account=nil)
8
8
  @account = account || Smartsend.account
@@ -14,6 +14,16 @@ class Smartsend::Client
14
14
  end
15
15
  end
16
16
 
17
+ def get(path)
18
+ request do
19
+ http.get("#{BASE_URL}/#{path}")
20
+ end
21
+ end
22
+
23
+ def get_plain(path)
24
+ http.get("#{BASE_URL}/#{path}")
25
+ end
26
+
17
27
  def request
18
28
  response = yield
19
29
 
@@ -11,7 +11,7 @@ class Smartsend::Order
11
11
  end
12
12
 
13
13
  def save!(account: nil)
14
- response = Smartsend::Client.new(account).post('order', self.serialize)
14
+ response = Smartsend::Client.new(account).post('booking/order', self.serialize)
15
15
 
16
16
  if response.success?
17
17
  update_label_url_tracking_codes(response)
@@ -1,3 +1,3 @@
1
1
  module Smartsend
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartsend-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aske Hansen
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  requirements: []
80
80
  rubyforge_project:
81
- rubygems_version: 2.5.2
81
+ rubygems_version: 2.6.11
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: Smartsend.io api client