smartsend-ruby 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/smartsend/account.rb +3 -3
- data/lib/smartsend/client.rb +5 -1
- data/lib/smartsend/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6559955d47563838d40e6ed2a3a197c5af19783a5f3b9e8c224941d72a6537f9
|
4
|
+
data.tar.gz: 99914570cb17b3a22c2fe281e25b17463cecdcc4653600dbb25b5521a20f7999
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06e31ba54f3a013a8ea876721a13a89df59d6c624c029f1c9c264f00afac69763a61047acf9da8e1ab93de84ac6c197af3003b3f9778f23e5eb8d49c3a97bebb
|
7
|
+
data.tar.gz: 9f93847459da401435b5be8d645f2ee891bfcc1a57bd6371fc5bb9e0204cd6c817ede13a36d68bf1b7d3b27e2f66e7beecc8fdf5607631a2536c7f6a6bfd648d
|
data/lib/smartsend/account.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
class Smartsend::Account
|
2
|
-
attr_accessor :api_token
|
3
|
-
attr_accessor :referer
|
2
|
+
attr_accessor :api_token, :referer, :user_agents
|
4
3
|
|
5
|
-
def initialize(api_token:, referer: nil)
|
4
|
+
def initialize(api_token:, referer: nil, user_agents: nil)
|
6
5
|
@api_token = api_token
|
7
6
|
@referer = referer
|
7
|
+
@user_agents = user_agents
|
8
8
|
end
|
9
9
|
|
10
10
|
def valid?
|
data/lib/smartsend/client.rb
CHANGED
@@ -78,12 +78,16 @@ class Smartsend::Client
|
|
78
78
|
Logger.new($stdout)
|
79
79
|
end
|
80
80
|
|
81
|
+
def user_agent_string
|
82
|
+
(["Ruby/#{Smartsend::VERSION}"] + @account.user_agents.to_a).join(' ')
|
83
|
+
end
|
84
|
+
|
81
85
|
def http
|
82
86
|
raise Smartsend::MissingConfigError, 'Missing api_token' if @account.api_token.nil?
|
83
87
|
|
84
88
|
HTTP.headers({
|
85
89
|
accept: 'application/json',
|
86
|
-
user_agent:
|
90
|
+
user_agent: user_agent_string,
|
87
91
|
referer: @account.referer
|
88
92
|
})
|
89
93
|
end
|
data/lib/smartsend/version.rb
CHANGED