velocify 0.1.5 → 0.1.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 +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +9 -0
- data/lib/velocify.rb +23 -3
- data/lib/velocify/model.rb +4 -8
- data/lib/velocify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dfb40bb9964cb7848245548804fbf1afa856aaa
|
4
|
+
data.tar.gz: bac9230a7f0ffd5f32e76bcb53f44da4b48fa644
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 712b29bccf0070f6ec4c6d8515f06d21d5814ab0d5fe74940920345b79aa2887666700aef244f1b21422e7a13c2a3efc7b88697f39f36e0ea7754c033f6e9763
|
7
|
+
data.tar.gz: 70d94b691523358baf9cbe4f80a5afd1a790193ee9829a351edf54026678fbefe04e03c09efae6523dfafce020f1121e131ed3f056a25366174ab9dfde1d4232
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
# Changes in 0.1.6
|
2
|
+
|
3
|
+
* Supports programmatic configuration of Velocify credentials:
|
4
|
+
|
5
|
+
``` ruby
|
6
|
+
Velocify.configure do |config|
|
7
|
+
config.username = "dummy"
|
8
|
+
config.password = "pass"
|
9
|
+
end
|
10
|
+
```
|
11
|
+
|
1
12
|
# Changes in 0.1.5
|
2
13
|
|
3
14
|
* Fixes bug in ```return_array: ``` option for ```Velocify::Lead.add```
|
data/README.md
CHANGED
@@ -25,6 +25,15 @@ Or install it yourself as:
|
|
25
25
|
Before getting started, you must export two environment variables: ```VELOCIFY_USERNAME``` and ```VELOCIFY_PASSWORD```.
|
26
26
|
This gem uses Dotenv, so you can add these variables to your ```.env``` file in the root folder of your project.
|
27
27
|
|
28
|
+
You can also programmatically configure the username and password:
|
29
|
+
|
30
|
+
``` ruby
|
31
|
+
Velocify.configure do |config|
|
32
|
+
config.username = "myusername"
|
33
|
+
config.password = "mypassword"
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
28
37
|
``` ruby
|
29
38
|
require 'velocify'
|
30
39
|
|
data/lib/velocify.rb
CHANGED
@@ -3,6 +3,29 @@ require "dotenv"
|
|
3
3
|
|
4
4
|
Dotenv.load
|
5
5
|
|
6
|
+
module Velocify
|
7
|
+
class Config
|
8
|
+
attr_accessor :username, :password
|
9
|
+
end
|
10
|
+
|
11
|
+
class << self
|
12
|
+
# @return [Config] the global config object
|
13
|
+
def config
|
14
|
+
@config ||= Config.new.tap do |config|
|
15
|
+
config.username = ENV['VELOCIFY_USERNAME']
|
16
|
+
config.password = ENV['VELOCIFY_PASSWORD']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Programmatically configure your connection to Velocify
|
21
|
+
#
|
22
|
+
# @yield [config] the block that contains the Config object
|
23
|
+
def configure &blk
|
24
|
+
blk.call config
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
6
29
|
require "velocify/version"
|
7
30
|
require "velocify/model"
|
8
31
|
require "velocify/campaign"
|
@@ -16,6 +39,3 @@ require "velocify/report"
|
|
16
39
|
require "velocify/response_reader"
|
17
40
|
require "velocify/message_payload"
|
18
41
|
require "velocify/add_leads_payload"
|
19
|
-
|
20
|
-
module Velocify
|
21
|
-
end
|
data/lib/velocify/model.rb
CHANGED
@@ -110,11 +110,7 @@ module Velocify
|
|
110
110
|
end
|
111
111
|
|
112
112
|
module ModelHelpers
|
113
|
-
attr :username, :password
|
114
|
-
|
115
113
|
def authenticate!
|
116
|
-
@username = ENV['VELOCIFY_USERNAME']
|
117
|
-
@password = ENV['VELOCIFY_PASSWORD']
|
118
114
|
valid_credentials?
|
119
115
|
end
|
120
116
|
|
@@ -125,14 +121,14 @@ module Velocify
|
|
125
121
|
private
|
126
122
|
|
127
123
|
def verify_credentials!
|
128
|
-
if
|
124
|
+
if Velocify.config.username.nil? || Velocify.config.password.nil?
|
129
125
|
raise Velocify::AuthenticationException, "You must export your credentials to the environment"
|
130
126
|
end
|
131
127
|
end
|
132
128
|
|
133
129
|
def valid_credentials?
|
134
|
-
return false if
|
135
|
-
|
130
|
+
return false if Velocify.config.username.nil? || Velocify.config.password.nil?
|
131
|
+
!Velocify.config.username.empty? && !Velocify.config.password.empty?
|
136
132
|
end
|
137
133
|
|
138
134
|
def request destruct: false, &block
|
@@ -140,7 +136,7 @@ module Velocify
|
|
140
136
|
request_builder = RequestBuilder.new
|
141
137
|
request_builder.instance_eval(&block)
|
142
138
|
request = request_builder.build
|
143
|
-
client = Client.new request, username:
|
139
|
+
client = Client.new request, username: Velocify.config.username, password: Velocify.config.password
|
144
140
|
|
145
141
|
if destruct || request.destruct_response?
|
146
142
|
result = client.call
|
data/lib/velocify/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: velocify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Dyba
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|