upland_mobile_commons_rest 0.4.0 → 1.0.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 +4 -4
- data/README.md +1 -1
- data/VERSION +1 -1
- data/example.rb +1 -1
- data/lib/upland_mobile_commons_rest/client.rb +3 -8
- data/spec/campaigns_spec.rb +3 -4
- data/spec/client_spec.rb +1 -1
- data/spec/group_spec.rb +2 -3
- data/spec/profiles_spec.rb +2 -3
- data/spec/support/stub_requests.rb +1 -1
- data/spec/upland_mobile_commons_rest_spec.rb +2 -3
- data/upland_mobile_commons_rest.gemspec +2 -2
- 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: 7eeb5aa6f582aae208a7c1ed4e627a69454b7b5bad0edbba363c3276aa9e5bba
|
|
4
|
+
data.tar.gz: 4733707638a2af5f2d40ed67d409c297e60863c876c9aa6a8e1c8d133cab0a88
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9b990cd60a602fd296391f8bbef791dce0d9137b5aee8868d96b02963895bcd6db6f13631147a9279db5f47ded6095e7073888c7dfcef9e90c0aba23285855df
|
|
7
|
+
data.tar.gz: 125fd17ffd7bbcf82932c6db8fe37817c5801c20fb616d92a8e32998910e537e6f08c9f72f484331da888445e019e715612dc9c688b29da02eb5fc2884ced697
|
data/README.md
CHANGED
|
@@ -6,7 +6,7 @@ A ruby gem for interacting with the Upland Mobile Commons API.
|
|
|
6
6
|
## Usage
|
|
7
7
|
|
|
8
8
|
```ruby
|
|
9
|
-
client = UplandMobileCommonsRest.new(
|
|
9
|
+
client = UplandMobileCommonsRest.new(api_key: 'api-key')
|
|
10
10
|
# List Campaigns
|
|
11
11
|
client.campaigns.list
|
|
12
12
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
1.0.1
|
data/example.rb
CHANGED
|
@@ -8,7 +8,7 @@ require 'byebug'
|
|
|
8
8
|
|
|
9
9
|
Dotenv.load('.env')
|
|
10
10
|
|
|
11
|
-
client = UplandMobileCommonsRest.new(
|
|
11
|
+
client = UplandMobileCommonsRest.new(api_key: ENV['API_KEY']) # rubocop:disable Lint/UselessAssignment
|
|
12
12
|
|
|
13
13
|
puts "Ready to call MobileCommons API using 'client' object"
|
|
14
14
|
byebug # rubocop:disable Lint/Debugger
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
module UplandMobileCommonsRest
|
|
4
4
|
class Client < Vertebrae::API
|
|
5
|
-
attr_accessor :
|
|
5
|
+
attr_accessor :api_key
|
|
6
6
|
|
|
7
7
|
def initialize(options = {}, &block)
|
|
8
|
-
self.
|
|
9
|
-
self.password = options[:password]
|
|
10
|
-
self.company_key = options[:company_key]
|
|
8
|
+
self.api_key = options.delete(:api_key)
|
|
11
9
|
super(options, &block)
|
|
12
10
|
end
|
|
13
11
|
|
|
@@ -28,10 +26,7 @@ module UplandMobileCommonsRest
|
|
|
28
26
|
# Request middlewares, in the order they should run
|
|
29
27
|
builder.use Faraday::Request::Multipart
|
|
30
28
|
builder.use Faraday::Request::UrlEncoded
|
|
31
|
-
|
|
32
|
-
builder.use Faraday::Request::BasicAuthentication, connection.configuration.username,
|
|
33
|
-
connection.configuration.password
|
|
34
|
-
end
|
|
29
|
+
builder.use Faraday::Request::Authorization, 'Bearer', self.api_key
|
|
35
30
|
|
|
36
31
|
# Response middlewares, in the *reverse* order they should run
|
|
37
32
|
builder.use UplandMobileCommonsRest::TypedErrorMiddleware
|
data/spec/campaigns_spec.rb
CHANGED
|
@@ -3,17 +3,16 @@
|
|
|
3
3
|
require 'spec_helper'
|
|
4
4
|
|
|
5
5
|
describe UplandMobileCommonsRest::Campaigns do
|
|
6
|
-
let(:client) { UplandMobileCommonsRest::Client.new(
|
|
6
|
+
let(:client) { UplandMobileCommonsRest::Client.new(api_key: 'abcde-123456') }
|
|
7
7
|
|
|
8
|
-
subject { UplandMobileCommonsRest::Campaigns.new(client:
|
|
8
|
+
subject { UplandMobileCommonsRest::Campaigns.new(client:) }
|
|
9
9
|
|
|
10
10
|
it 'should initialize' do
|
|
11
11
|
expect(subject.client).to eq(client)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
context 'with credentials' do
|
|
15
|
-
let(:
|
|
16
|
-
let(:password) { 'password' }
|
|
15
|
+
let(:api_key) { 'abcde-123456' }
|
|
17
16
|
|
|
18
17
|
describe 'list' do
|
|
19
18
|
let(:response_body) { fixture('campaigns/list.xml') }
|
data/spec/client_spec.rb
CHANGED
|
@@ -21,7 +21,7 @@ describe UplandMobileCommonsRest::Client do
|
|
|
21
21
|
describe 'error handling' do
|
|
22
22
|
let(:request_params) { {example: 'data'} }
|
|
23
23
|
|
|
24
|
-
subject { UplandMobileCommonsRest::Client.new(
|
|
24
|
+
subject { UplandMobileCommonsRest::Client.new(api_key: 'abcde-123456') }
|
|
25
25
|
|
|
26
26
|
before :each do
|
|
27
27
|
stub_request(:post, 'https://secure.mcommons.com/api/do_something')
|
data/spec/group_spec.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
require 'spec_helper'
|
|
4
4
|
|
|
5
5
|
describe UplandMobileCommonsRest::Groups do
|
|
6
|
-
let(:client) { UplandMobileCommonsRest::Client.new(
|
|
6
|
+
let(:client) { UplandMobileCommonsRest::Client.new(api_key: 'abcde-123456') }
|
|
7
7
|
|
|
8
8
|
subject { UplandMobileCommonsRest::Groups.new(client: client) }
|
|
9
9
|
|
|
@@ -12,8 +12,7 @@ describe UplandMobileCommonsRest::Groups do
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
context 'with credentials' do
|
|
15
|
-
let(:
|
|
16
|
-
let(:password) { 'password' }
|
|
15
|
+
let(:api_key) { 'abcde-123456' }
|
|
17
16
|
|
|
18
17
|
describe 'list' do
|
|
19
18
|
let(:response_body) { fixture('groups/list.xml') }
|
data/spec/profiles_spec.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
require 'spec_helper'
|
|
4
4
|
|
|
5
5
|
describe UplandMobileCommonsRest::Profiles do
|
|
6
|
-
let(:client) { UplandMobileCommonsRest::Client.new(
|
|
6
|
+
let(:client) { UplandMobileCommonsRest::Client.new(api_key: 'abcde-123456') }
|
|
7
7
|
|
|
8
8
|
subject { UplandMobileCommonsRest::Profiles.new(client: client) }
|
|
9
9
|
|
|
@@ -12,8 +12,7 @@ describe UplandMobileCommonsRest::Profiles do
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
context 'with credentials' do
|
|
15
|
-
let(:
|
|
16
|
-
let(:password) { 'password' }
|
|
15
|
+
let(:api_key) { 'abcde-123456' }
|
|
17
16
|
let(:phone_number) { '123-256-7890' }
|
|
18
17
|
|
|
19
18
|
describe 'get' do
|
|
@@ -4,9 +4,8 @@ require 'spec_helper'
|
|
|
4
4
|
|
|
5
5
|
describe UplandMobileCommonsRest do
|
|
6
6
|
it 'returns a client' do
|
|
7
|
-
client = UplandMobileCommonsRest.new(
|
|
7
|
+
client = UplandMobileCommonsRest.new(api_key: 'abcde-123456')
|
|
8
8
|
expect(client).to be_an_instance_of(UplandMobileCommonsRest::Client)
|
|
9
|
-
expect(client.
|
|
10
|
-
expect(client.password).to eq('bar')
|
|
9
|
+
expect(client.api_key).to eq('abcde-123456')
|
|
11
10
|
end
|
|
12
11
|
end
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: upland_mobile_commons_rest 0.
|
|
5
|
+
# stub: upland_mobile_commons_rest 1.0.1 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "upland_mobile_commons_rest".freeze
|
|
9
|
-
s.version = "0.
|
|
9
|
+
s.version = "1.0.1".freeze
|
|
10
10
|
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
12
12
|
s.require_paths = ["lib".freeze]
|