upland_mobile_commons_rest 0.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 +7 -0
- data/.document +5 -0
- data/.rubocop.yml +26 -0
- data/.travis.yml +9 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +21 -0
- data/Gemfile.lock +154 -0
- data/LICENSE.txt +20 -0
- data/README.md +19 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/example.rb +15 -0
- data/lib/upland_mobile_commons_rest.rb +20 -0
- data/lib/upland_mobile_commons_rest/base.rb +8 -0
- data/lib/upland_mobile_commons_rest/campaigns.rb +13 -0
- data/lib/upland_mobile_commons_rest/client.rb +60 -0
- data/lib/upland_mobile_commons_rest/errors.rb +93 -0
- data/lib/upland_mobile_commons_rest/groups.rb +27 -0
- data/lib/upland_mobile_commons_rest/profiles.rb +8 -0
- data/spec/campaigns_spec.rb +29 -0
- data/spec/client_spec.rb +18 -0
- data/spec/fixtures/campaigns/list.xml +34 -0
- data/spec/fixtures/error.xml +1 -0
- data/spec/fixtures/groups/create.xml +4 -0
- data/spec/fixtures/groups/list.xml +13 -0
- data/spec/fixtures/profiles/update.xml +44 -0
- data/spec/group_spec.rb +44 -0
- data/spec/profiles_spec.rb +40 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/support/fixtures.rb +3 -0
- data/spec/support/stub_requests.rb +4 -0
- data/spec/upland_mobile_commons_rest_spec.rb +12 -0
- data/upland_mobile_commons_rest.gemspec +102 -0
- metadata +230 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: fea28fb6b44128149d673e0a44a7e709ae20ed9e8df8d23caba96eb61b57ba81
|
|
4
|
+
data.tar.gz: 438ffc1b50e2bb7b625d67d09201498030e1882e5b6b250f01c37e0221c0de7c
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: de00accf8fd3630b0cee809b05c952f1a51d6b0552c8ec8995b4ccfe99ee35b11555717c3b8be9292fe5906c1e3c5b19e6ab2a03f692aee72f476d84492e68aa
|
|
7
|
+
data.tar.gz: ce9b7d848838ff6ce8e1508ac3e909d355aa6993d020149ac5d1706a4491d5ac973ec292c7226472569fe6fb58c48aa1b3de4c57e24b10a78e10be0e9c26826f
|
data/.document
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
DisabledByDefault: true
|
|
3
|
+
|
|
4
|
+
Security:
|
|
5
|
+
Enabled: true
|
|
6
|
+
|
|
7
|
+
Bundler/DuplicatedGem:
|
|
8
|
+
Enabled: true
|
|
9
|
+
Bundler/InsecureProtocolSource:
|
|
10
|
+
Enabled: true
|
|
11
|
+
Layout/IndentationStyle:
|
|
12
|
+
Enabled: true
|
|
13
|
+
Layout/SpaceInsideRangeLiteral:
|
|
14
|
+
Enabled: true
|
|
15
|
+
Lint:
|
|
16
|
+
Enabled: true
|
|
17
|
+
Lint/RaiseException:
|
|
18
|
+
Enabled: true
|
|
19
|
+
Naming/AsciiIdentifiers:
|
|
20
|
+
Enabled: true
|
|
21
|
+
Naming/ClassAndModuleCamelCase:
|
|
22
|
+
Enabled: true
|
|
23
|
+
Naming/ConstantName:
|
|
24
|
+
Enabled: true
|
|
25
|
+
Naming/FileName:
|
|
26
|
+
Enabled: true
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at talk@controlshiftlabs.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
source "https://rubygems.org"
|
|
2
|
+
# Add dependencies required to use your gem here.
|
|
3
|
+
# Example:
|
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
|
5
|
+
|
|
6
|
+
gem 'vertebrae'
|
|
7
|
+
|
|
8
|
+
# Add dependencies to develop your gem here.
|
|
9
|
+
# Include everything needed to run rake, tests, features, etc.
|
|
10
|
+
group :development do
|
|
11
|
+
gem "shoulda", ">= 0"
|
|
12
|
+
gem "rdoc", "> 3.12"
|
|
13
|
+
gem "bundler", "> 2.0"
|
|
14
|
+
gem "juwelier", git: 'https://github.com/flajann2/juwelier.git'
|
|
15
|
+
gem "simplecov", ">= 0"
|
|
16
|
+
gem "dotenv"
|
|
17
|
+
gem "byebug"
|
|
18
|
+
gem "rubocop"
|
|
19
|
+
gem "rspec"
|
|
20
|
+
gem "webmock"
|
|
21
|
+
end
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
GIT
|
|
2
|
+
remote: https://github.com/flajann2/juwelier.git
|
|
3
|
+
revision: de59d5a2ddea00c1f18957ab62129c1c141acce1
|
|
4
|
+
specs:
|
|
5
|
+
juwelier (2.4.9)
|
|
6
|
+
builder
|
|
7
|
+
bundler
|
|
8
|
+
git
|
|
9
|
+
github_api
|
|
10
|
+
highline
|
|
11
|
+
kamelcase (~> 0)
|
|
12
|
+
nokogiri
|
|
13
|
+
psych
|
|
14
|
+
rake
|
|
15
|
+
rdoc
|
|
16
|
+
semver2
|
|
17
|
+
|
|
18
|
+
GEM
|
|
19
|
+
remote: https://rubygems.org/
|
|
20
|
+
specs:
|
|
21
|
+
activesupport (6.0.3.1)
|
|
22
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
23
|
+
i18n (>= 0.7, < 2)
|
|
24
|
+
minitest (~> 5.1)
|
|
25
|
+
tzinfo (~> 1.1)
|
|
26
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
|
27
|
+
addressable (2.7.0)
|
|
28
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
29
|
+
ast (2.4.0)
|
|
30
|
+
builder (3.2.4)
|
|
31
|
+
byebug (11.1.3)
|
|
32
|
+
concurrent-ruby (1.1.6)
|
|
33
|
+
crack (0.4.3)
|
|
34
|
+
safe_yaml (~> 1.0.0)
|
|
35
|
+
descendants_tracker (0.0.4)
|
|
36
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
|
37
|
+
diff-lcs (1.3)
|
|
38
|
+
docile (1.3.2)
|
|
39
|
+
dotenv (2.7.5)
|
|
40
|
+
faraday (0.17.3)
|
|
41
|
+
multipart-post (>= 1.2, < 3)
|
|
42
|
+
faraday_middleware (0.14.0)
|
|
43
|
+
faraday (>= 0.7.4, < 1.0)
|
|
44
|
+
git (1.7.0)
|
|
45
|
+
rchardet (~> 1.8)
|
|
46
|
+
github_api (0.18.2)
|
|
47
|
+
addressable (~> 2.4)
|
|
48
|
+
descendants_tracker (~> 0.0.4)
|
|
49
|
+
faraday (~> 0.8)
|
|
50
|
+
hashie (~> 3.5, >= 3.5.2)
|
|
51
|
+
oauth2 (~> 1.0)
|
|
52
|
+
hashdiff (1.0.1)
|
|
53
|
+
hashie (3.6.0)
|
|
54
|
+
highline (2.0.3)
|
|
55
|
+
i18n (1.8.3)
|
|
56
|
+
concurrent-ruby (~> 1.0)
|
|
57
|
+
jwt (2.2.1)
|
|
58
|
+
kamelcase (0.0.2)
|
|
59
|
+
semver2 (~> 3)
|
|
60
|
+
mini_portile2 (2.4.0)
|
|
61
|
+
minitest (5.14.1)
|
|
62
|
+
multi_json (1.14.1)
|
|
63
|
+
multi_xml (0.6.0)
|
|
64
|
+
multipart-post (2.1.1)
|
|
65
|
+
nokogiri (1.10.9)
|
|
66
|
+
mini_portile2 (~> 2.4.0)
|
|
67
|
+
oauth2 (1.4.4)
|
|
68
|
+
faraday (>= 0.8, < 2.0)
|
|
69
|
+
jwt (>= 1.0, < 3.0)
|
|
70
|
+
multi_json (~> 1.3)
|
|
71
|
+
multi_xml (~> 0.5)
|
|
72
|
+
rack (>= 1.2, < 3)
|
|
73
|
+
parallel (1.19.1)
|
|
74
|
+
parser (2.7.1.3)
|
|
75
|
+
ast (~> 2.4.0)
|
|
76
|
+
psych (3.1.0)
|
|
77
|
+
public_suffix (4.0.5)
|
|
78
|
+
rack (2.2.2)
|
|
79
|
+
rainbow (3.0.0)
|
|
80
|
+
rake (13.0.1)
|
|
81
|
+
rchardet (1.8.0)
|
|
82
|
+
rdoc (6.2.1)
|
|
83
|
+
regexp_parser (1.7.0)
|
|
84
|
+
rexml (3.2.4)
|
|
85
|
+
rspec (3.9.0)
|
|
86
|
+
rspec-core (~> 3.9.0)
|
|
87
|
+
rspec-expectations (~> 3.9.0)
|
|
88
|
+
rspec-mocks (~> 3.9.0)
|
|
89
|
+
rspec-core (3.9.2)
|
|
90
|
+
rspec-support (~> 3.9.3)
|
|
91
|
+
rspec-expectations (3.9.2)
|
|
92
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
93
|
+
rspec-support (~> 3.9.0)
|
|
94
|
+
rspec-mocks (3.9.1)
|
|
95
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
96
|
+
rspec-support (~> 3.9.0)
|
|
97
|
+
rspec-support (3.9.3)
|
|
98
|
+
rubocop (0.85.0)
|
|
99
|
+
parallel (~> 1.10)
|
|
100
|
+
parser (>= 2.7.0.1)
|
|
101
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
102
|
+
regexp_parser (>= 1.7)
|
|
103
|
+
rexml
|
|
104
|
+
rubocop-ast (>= 0.0.3)
|
|
105
|
+
ruby-progressbar (~> 1.7)
|
|
106
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
|
107
|
+
rubocop-ast (0.0.3)
|
|
108
|
+
parser (>= 2.7.0.1)
|
|
109
|
+
ruby-progressbar (1.10.1)
|
|
110
|
+
safe_yaml (1.0.5)
|
|
111
|
+
semver2 (3.4.2)
|
|
112
|
+
shoulda (3.6.0)
|
|
113
|
+
shoulda-context (~> 1.0, >= 1.0.1)
|
|
114
|
+
shoulda-matchers (~> 3.0)
|
|
115
|
+
shoulda-context (1.2.2)
|
|
116
|
+
shoulda-matchers (3.1.3)
|
|
117
|
+
activesupport (>= 4.0.0)
|
|
118
|
+
simplecov (0.18.5)
|
|
119
|
+
docile (~> 1.1)
|
|
120
|
+
simplecov-html (~> 0.11)
|
|
121
|
+
simplecov-html (0.12.2)
|
|
122
|
+
thread_safe (0.3.6)
|
|
123
|
+
tzinfo (1.2.7)
|
|
124
|
+
thread_safe (~> 0.1)
|
|
125
|
+
unicode-display_width (1.7.0)
|
|
126
|
+
vertebrae (0.6.2)
|
|
127
|
+
activesupport (>= 5.1.4)
|
|
128
|
+
faraday (> 0.9.2)
|
|
129
|
+
faraday_middleware (> 0.12.2)
|
|
130
|
+
hashie (> 3.5.7)
|
|
131
|
+
webmock (3.8.3)
|
|
132
|
+
addressable (>= 2.3.6)
|
|
133
|
+
crack (>= 0.3.2)
|
|
134
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
|
135
|
+
zeitwerk (2.3.0)
|
|
136
|
+
|
|
137
|
+
PLATFORMS
|
|
138
|
+
ruby
|
|
139
|
+
|
|
140
|
+
DEPENDENCIES
|
|
141
|
+
bundler (> 2.0)
|
|
142
|
+
byebug
|
|
143
|
+
dotenv
|
|
144
|
+
juwelier!
|
|
145
|
+
rdoc (> 3.12)
|
|
146
|
+
rspec
|
|
147
|
+
rubocop
|
|
148
|
+
shoulda
|
|
149
|
+
simplecov
|
|
150
|
+
vertebrae
|
|
151
|
+
webmock
|
|
152
|
+
|
|
153
|
+
BUNDLED WITH
|
|
154
|
+
2.1.4
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2020 ChangeSprout, Inc.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Upland Mobile Commons Ruby Gem
|
|
2
|
+
[](https://travis-ci.org/controlshift/upland_mobile_commons_rest)
|
|
3
|
+
|
|
4
|
+
A ruby gem for interacting with the Upland Mobile Commons API.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
```ruby
|
|
9
|
+
client = UplandMobileCommonsRest.new(username: 'user', password: 'password')
|
|
10
|
+
# List Campaigns
|
|
11
|
+
client.campaigns.list
|
|
12
|
+
|
|
13
|
+
# create a group
|
|
14
|
+
client.groups.create('Chocolate Lovers')
|
|
15
|
+
|
|
16
|
+
# create/update a profile
|
|
17
|
+
client.profiles.update(phone_number: '123-456-7890')
|
|
18
|
+
```
|
|
19
|
+
|
data/Rakefile
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
require 'bundler'
|
|
6
|
+
begin
|
|
7
|
+
Bundler.setup(:default, :development)
|
|
8
|
+
rescue Bundler::BundlerError => e
|
|
9
|
+
$stderr.puts e.message
|
|
10
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
|
11
|
+
exit e.status_code
|
|
12
|
+
end
|
|
13
|
+
require 'rake'
|
|
14
|
+
require 'juwelier'
|
|
15
|
+
Juwelier::Tasks.new do |gem|
|
|
16
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
|
17
|
+
gem.name = "upland_mobile_commons_rest"
|
|
18
|
+
gem.homepage = "http://github.com/controlshift/upland_mobile_commons_rest"
|
|
19
|
+
gem.license = "MIT"
|
|
20
|
+
gem.summary = %Q{API client gem for Upland Mobile Commons}
|
|
21
|
+
gem.description = %Q{A simple ruby API client gem for the Upland Mobile Commons REST API}
|
|
22
|
+
gem.email = "nathan@controlshiftlabs.com"
|
|
23
|
+
gem.authors = ["Nathan Woodhull"]
|
|
24
|
+
|
|
25
|
+
# dependencies defined in Gemfile
|
|
26
|
+
end
|
|
27
|
+
Juwelier::RubygemsDotOrgTasks.new
|
|
28
|
+
|
|
29
|
+
desc "Code coverage detail"
|
|
30
|
+
task :simplecov do
|
|
31
|
+
ENV['COVERAGE'] = "true"
|
|
32
|
+
Rake::Task['test'].execute
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
require 'rspec/core/rake_task'
|
|
37
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
task :default => :spec
|
|
41
|
+
|
|
42
|
+
require 'rdoc/task'
|
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
|
44
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
|
45
|
+
|
|
46
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
47
|
+
rdoc.title = "upland_mobile_commons_rest #{version}"
|
|
48
|
+
rdoc.rdoc_files.include('README*')
|
|
49
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
50
|
+
end
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.0.1
|
data/example.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__), 'lib')
|
|
3
|
+
|
|
4
|
+
require 'upland_mobile_commons_rest'
|
|
5
|
+
require 'dotenv'
|
|
6
|
+
require 'byebug'
|
|
7
|
+
|
|
8
|
+
Dotenv.load('.env')
|
|
9
|
+
|
|
10
|
+
client = UplandMobileCommonsRest.new(username: ENV['USERNAME'], password: ENV['PASSWORD'] ) # rubocop:disable Lint/UselessAssignment
|
|
11
|
+
|
|
12
|
+
puts "Ready to call MobileCommons API using 'client' object"
|
|
13
|
+
byebug # rubocop:disable Lint/Debugger
|
|
14
|
+
|
|
15
|
+
puts "Bye!"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'vertebrae'
|
|
4
|
+
|
|
5
|
+
module UplandMobileCommonsRest
|
|
6
|
+
extend Vertebrae::Base
|
|
7
|
+
|
|
8
|
+
class << self
|
|
9
|
+
def new(options = {})
|
|
10
|
+
UplandMobileCommonsRest::Client.new(options)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
require 'upland_mobile_commons_rest/client'
|
|
16
|
+
require 'upland_mobile_commons_rest/base'
|
|
17
|
+
require 'upland_mobile_commons_rest/campaigns'
|
|
18
|
+
require 'upland_mobile_commons_rest/groups'
|
|
19
|
+
require 'upland_mobile_commons_rest/profiles'
|
|
20
|
+
require 'upland_mobile_commons_rest/errors'
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UplandMobileCommonsRest
|
|
4
|
+
class Client < Vertebrae::API
|
|
5
|
+
attr_accessor :username, :password, :company_key
|
|
6
|
+
|
|
7
|
+
def initialize(options={}, &block)
|
|
8
|
+
self.username = options[:username]
|
|
9
|
+
self.password = options[:password]
|
|
10
|
+
self.company_key = options[:company_key]
|
|
11
|
+
super(options, &block)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def default_options
|
|
15
|
+
{
|
|
16
|
+
host: 'secure.mcommons.com',
|
|
17
|
+
prefix: '/api',
|
|
18
|
+
user_agent: 'ruby: UplandMobileCommonsRest',
|
|
19
|
+
content_type: 'application/x-www-form-urlencoded',
|
|
20
|
+
additional_headers: {
|
|
21
|
+
'Accept' => 'application/xml'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def setup
|
|
27
|
+
connection.stack do |builder|
|
|
28
|
+
builder.use Faraday::Request::Multipart
|
|
29
|
+
builder.use Faraday::Request::UrlEncoded
|
|
30
|
+
if connection.configuration.authenticated?
|
|
31
|
+
builder.use Faraday::Request::BasicAuthentication, connection.configuration.username, connection.configuration.password
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
builder.use UplandMobileCommonsRest::TypedErrorMiddleware
|
|
35
|
+
builder.use Faraday::Response::Logger if ENV['DEBUG']
|
|
36
|
+
builder.use FaradayMiddleware::ParseXml
|
|
37
|
+
|
|
38
|
+
builder.adapter connection.configuration.adapter
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def extract_data_from_params(params) # :nodoc:
|
|
43
|
+
URI.encode_www_form(params)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
## Helper functions to let consumers do things like `client.campaigns.list`
|
|
47
|
+
|
|
48
|
+
def campaigns
|
|
49
|
+
@_campaigns ||= UplandMobileCommonsRest::Campaigns.new(client: self)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def groups
|
|
53
|
+
@_groups ||= UplandMobileCommonsRest::Groups.new(client: self)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def profiles
|
|
57
|
+
@_profiles ||= UplandMobileCommonsRest::Profiles.new(client: self)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
module UplandMobileCommonsRest
|
|
2
|
+
class MobileCommonsError < StandardError
|
|
3
|
+
attr_accessor :code, :raw_message
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
class UnknownError < MobileCommonsError; end
|
|
7
|
+
class InvalidCampaignId < MobileCommonsError; end
|
|
8
|
+
class InvalidBroadcastTime < MobileCommonsError; end
|
|
9
|
+
class InvalidMessageBody < MobileCommonsError; end
|
|
10
|
+
class InvalidCompanyId < MobileCommonsError; end
|
|
11
|
+
class InvalidPhoneNumber < MobileCommonsError; end
|
|
12
|
+
class InvalidGroupId < MobileCommonsError; end
|
|
13
|
+
class InvalidStartTime < MobileCommonsError; end
|
|
14
|
+
class InvalidEndTime < MobileCommonsError; end
|
|
15
|
+
class InvalidMdataId < MobileCommonsError; end
|
|
16
|
+
class InvalidKey < MobileCommonsError; end
|
|
17
|
+
class PhoneIsNotOptedIntoThisCampaign < MobileCommonsError; end
|
|
18
|
+
class InvalidFundraisingId < MobileCommonsError; end
|
|
19
|
+
class InvalidMessageTemplate < MobileCommonsError; end
|
|
20
|
+
class PhoneIsNotTextable < MobileCommonsError; end
|
|
21
|
+
class InvalidMconnectId < MobileCommonsError; end
|
|
22
|
+
class InvalidQueryParameters < MobileCommonsError; end
|
|
23
|
+
class TooManyMessages < MobileCommonsError; end
|
|
24
|
+
class InvalidName < MobileCommonsError; end
|
|
25
|
+
class InvalidOptInPath < MobileCommonsError; end
|
|
26
|
+
class InvalidUrl < MobileCommonsError; end
|
|
27
|
+
class InvalidAttachment < MobileCommonsError; end
|
|
28
|
+
class InvalidBroadcastId < MobileCommonsError; end
|
|
29
|
+
class InvalidBroadcastStateChange < MobileCommonsError; end
|
|
30
|
+
class BroadcastHasNotBeenSent < MobileCommonsError; end
|
|
31
|
+
class MessageTemplateInvalid < MobileCommonsError; end
|
|
32
|
+
class InvalidUserId < MobileCommonsError; end
|
|
33
|
+
class APIRateLimitExceeded < MobileCommonsError; end
|
|
34
|
+
class MissingPhoneNumberParameter < MobileCommonsError; end
|
|
35
|
+
class InvalidProfileSaveItemBehavior < MobileCommonsError; end
|
|
36
|
+
class InvalidProfileAttributes < MobileCommonsError; end
|
|
37
|
+
class InvalidPreviousId < MobileCommonsError; end
|
|
38
|
+
class InvalidTagName < MobileCommonsError; end
|
|
39
|
+
class InvalidTagParameters < MobileCommonsError; end
|
|
40
|
+
class InvalidShortcodeId < MobileCommonsError; end
|
|
41
|
+
class InvalidDateRange < MobileCommonsError; end
|
|
42
|
+
class InvalidScheduledMessageId < MobileCommonsError; end
|
|
43
|
+
class MessageHasAlreadyBeenSent < MobileCommonsError; end
|
|
44
|
+
|
|
45
|
+
class TypedErrorMiddleware < Faraday::Response::Middleware
|
|
46
|
+
POSSIBLE_ERRORS = {
|
|
47
|
+
'0' => UnknownError,
|
|
48
|
+
'1' => InvalidCampaignId,
|
|
49
|
+
'2' => InvalidBroadcastTime,
|
|
50
|
+
'3' => InvalidMessageBody,
|
|
51
|
+
'4' => InvalidCompanyId,
|
|
52
|
+
'5' => InvalidPhoneNumber,
|
|
53
|
+
'6' => InvalidGroupId,
|
|
54
|
+
'7' => InvalidStartTime,
|
|
55
|
+
'8' => InvalidEndTime,
|
|
56
|
+
'9' => InvalidMdataId,
|
|
57
|
+
'10' => InvalidKey,
|
|
58
|
+
'11' => PhoneIsNotOptedIntoThisCampaign,
|
|
59
|
+
'12' => InvalidFundraisingId,
|
|
60
|
+
'13' => InvalidMessageTemplate,
|
|
61
|
+
'14' => PhoneIsNotTextable,
|
|
62
|
+
'15' => InvalidMconnectId,
|
|
63
|
+
'16' => InvalidQueryParameters,
|
|
64
|
+
'17' => TooManyMessages,
|
|
65
|
+
'18' => InvalidName,
|
|
66
|
+
'19' => InvalidOptInPath,
|
|
67
|
+
'20' => InvalidUrl,
|
|
68
|
+
'21' => InvalidAttachment,
|
|
69
|
+
'22' => InvalidBroadcastId,
|
|
70
|
+
'23' => InvalidBroadcastStateChange,
|
|
71
|
+
'24' => BroadcastHasNotBeenSent,
|
|
72
|
+
'25' => MessageTemplateInvalid,
|
|
73
|
+
'26' => InvalidUserId,
|
|
74
|
+
'27' => APIRateLimitExceeded,
|
|
75
|
+
'28' => MissingPhoneNumberParameter,
|
|
76
|
+
'29' => InvalidProfileSaveItemBehavior,
|
|
77
|
+
'30' => InvalidProfileAttributes,
|
|
78
|
+
'31' => InvalidPreviousId,
|
|
79
|
+
'32' => InvalidTagName,
|
|
80
|
+
'33' => InvalidTagParameters,
|
|
81
|
+
'34' => InvalidShortcodeId,
|
|
82
|
+
'35' => InvalidDateRange,
|
|
83
|
+
'36' => InvalidScheduledMessageId,
|
|
84
|
+
'37' => MessageHasAlreadyBeenSent
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
def on_complete(response)
|
|
88
|
+
if response.body['response']['success'] == 'false'
|
|
89
|
+
raise POSSIBLE_ERRORS[response.body['response']['error']['id']].new(response.body['response']['error']['message'])
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module UplandMobileCommonsRest
|
|
2
|
+
class Groups < Base
|
|
3
|
+
|
|
4
|
+
def base_path
|
|
5
|
+
'groups'
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def list
|
|
9
|
+
resp = client.get_request(base_path)
|
|
10
|
+
resp.body['response']['groups']['group']
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def create(name)
|
|
14
|
+
client.get_request("create_group?name=#{url_escape(name)}")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def add_member(group_id, phone_numbers)
|
|
18
|
+
phone_number_argument = if phone_numbers.is_a?(Array)
|
|
19
|
+
phone_numbers.join(',')
|
|
20
|
+
else
|
|
21
|
+
phone_numbers
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
client.get_request("add_group_member?group_id=#{url_escape(group_id)}&phone_number=#{url_escape(phone_number_argument)}")
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe UplandMobileCommonsRest::Campaigns do
|
|
4
|
+
let(:client) { UplandMobileCommonsRest::Client.new(username: 'username', password: 'password') }
|
|
5
|
+
|
|
6
|
+
subject { UplandMobileCommonsRest::Campaigns.new(client: client) }
|
|
7
|
+
|
|
8
|
+
it 'should initialize' do
|
|
9
|
+
expect(subject.client).to eq(client)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
context 'with credentials' do
|
|
13
|
+
let(:username) { 'username' }
|
|
14
|
+
let(:password) { 'password' }
|
|
15
|
+
|
|
16
|
+
describe 'list' do
|
|
17
|
+
let(:response_body) { fixture('campaigns/list.xml') }
|
|
18
|
+
|
|
19
|
+
before(:each) do
|
|
20
|
+
stub_upland_mobile_commons_request('campaigns', method: :get).to_return(status: 200, body: response_body)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'should return a list of campaigns' do
|
|
24
|
+
list = subject.list
|
|
25
|
+
expect(list).to be_a(Enumerable)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
data/spec/client_spec.rb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe UplandMobileCommonsRest::Client do
|
|
4
|
+
describe 'default_options' do
|
|
5
|
+
it 'should set some defaults' do
|
|
6
|
+
expect(subject.default_options[:user_agent]).to match(/ruby/)
|
|
7
|
+
expect(subject.default_options[:host]).to eq('secure.mcommons.com')
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
describe 'helpers' do
|
|
12
|
+
it 'should return campaigns helper' do
|
|
13
|
+
campaigns = subject.campaigns
|
|
14
|
+
expect(campaigns).to be_a(UplandMobileCommonsRest::Campaigns)
|
|
15
|
+
expect(campaigns.client).to eq(subject)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<response success="true">
|
|
3
|
+
<campaigns>
|
|
4
|
+
<campaign id="303" active="false">
|
|
5
|
+
<name>Campaign One</name>
|
|
6
|
+
<description></description>
|
|
7
|
+
<tags>
|
|
8
|
+
<tag>Tag Name Here</tag>
|
|
9
|
+
</tags>
|
|
10
|
+
<opt_in_paths>
|
|
11
|
+
<opt_in_path id="175057" active = "true">
|
|
12
|
+
<name>My Opt-In Path</name>
|
|
13
|
+
<tags>
|
|
14
|
+
<tag>OIP ABC</tag>
|
|
15
|
+
</tags>
|
|
16
|
+
</opt_in_path>
|
|
17
|
+
</opt_in_paths>
|
|
18
|
+
</campaign>
|
|
19
|
+
<campaign id="304" active="false">
|
|
20
|
+
<name>Huge Campaign</name>
|
|
21
|
+
<description></description>
|
|
22
|
+
<tags>
|
|
23
|
+
<tag>Tag Name Here</tag>
|
|
24
|
+
</tags>
|
|
25
|
+
</campaign>
|
|
26
|
+
<campaign id="305" active="true">
|
|
27
|
+
<name>Another Campaign</name>
|
|
28
|
+
<description>Campaign to end all campaigns</description>
|
|
29
|
+
<tags>
|
|
30
|
+
<tag>Tag Name Here</tag>
|
|
31
|
+
</tags>
|
|
32
|
+
</campaign>
|
|
33
|
+
</campaigns>
|
|
34
|
+
</response>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<response success="false"><error id="3" message="Invalid message body"/></response>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<response success="true">
|
|
3
|
+
<groups>
|
|
4
|
+
<group id="14" type="FilteredGroup" status="active">
|
|
5
|
+
<name>Group One</name>
|
|
6
|
+
<size>2</size>
|
|
7
|
+
</group>
|
|
8
|
+
<group id="91" type="UploadedGroup" status="active">
|
|
9
|
+
<name>Group Two</name>
|
|
10
|
+
<size>1</size>
|
|
11
|
+
</group>
|
|
12
|
+
</groups>
|
|
13
|
+
</response>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<response success="true">
|
|
3
|
+
<profile id="34xxxxxxx">
|
|
4
|
+
<first_name>John</first_name>
|
|
5
|
+
<last_name>Doe</last_name>
|
|
6
|
+
<phone_number>12025551234</phone_number>
|
|
7
|
+
<email/>
|
|
8
|
+
<status>Active subscriber</status>
|
|
9
|
+
<created_at>2019-06-21 14:49:40 UTC</created_at>
|
|
10
|
+
<updated_at>2019-06-21 14:49:40 UTC</updated_at>
|
|
11
|
+
<opted_out_at/>
|
|
12
|
+
<opted_out_source/>
|
|
13
|
+
<source type="API" name="User1" email="user1@domain.com"/>
|
|
14
|
+
<address>
|
|
15
|
+
<street1/>
|
|
16
|
+
<street2/>
|
|
17
|
+
<city/>
|
|
18
|
+
<state/>
|
|
19
|
+
<postal_code/>
|
|
20
|
+
<country>US</country>
|
|
21
|
+
</address>
|
|
22
|
+
<last_saved_location>
|
|
23
|
+
<latitude>38.906639</latitude>
|
|
24
|
+
<longitude>-77.016577</longitude>
|
|
25
|
+
<precision>state</precision>
|
|
26
|
+
<city/>
|
|
27
|
+
<state>DC</state>
|
|
28
|
+
<postal_code/>
|
|
29
|
+
<country>US</country>
|
|
30
|
+
</last_saved_location>
|
|
31
|
+
<custom_columns>
|
|
32
|
+
<custom_column name="Age"/>
|
|
33
|
+
<custom_column name="Favorite animal"/>
|
|
34
|
+
<custom_column name="Yes/NO"/>
|
|
35
|
+
</custom_columns>
|
|
36
|
+
<subscriptions>
|
|
37
|
+
<subscription campaign_id="162xxx" campaign_name="MC_test2" campaign_description="" opt_in_path_id="" status="Active" opt_in_source="User1" created_at="2019-06-21T14:49:40Z" activated_at="2019-06-22T20:24:36Z" opted_out_at="" opt_out_source=""/>
|
|
38
|
+
</subscriptions>
|
|
39
|
+
<integrations>
|
|
40
|
+
</integrations>
|
|
41
|
+
<clicks>
|
|
42
|
+
</clicks>
|
|
43
|
+
</profile>
|
|
44
|
+
</response>
|
data/spec/group_spec.rb
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe UplandMobileCommonsRest::Groups do
|
|
4
|
+
let(:client) { UplandMobileCommonsRest::Client.new(username: 'username', password: 'password') }
|
|
5
|
+
|
|
6
|
+
subject { UplandMobileCommonsRest::Groups.new(client: client) }
|
|
7
|
+
|
|
8
|
+
it 'should initialize' do
|
|
9
|
+
expect(subject.client).to eq(client)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
context 'with credentials' do
|
|
13
|
+
let(:username) { 'username' }
|
|
14
|
+
let(:password) { 'password' }
|
|
15
|
+
|
|
16
|
+
describe 'list' do
|
|
17
|
+
let(:response_body) { fixture('groups/list.xml') }
|
|
18
|
+
|
|
19
|
+
before(:each) do
|
|
20
|
+
stub_upland_mobile_commons_request('groups', method: :get).to_return(status: 200, body: response_body)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'should return a list of groups' do
|
|
24
|
+
list = subject.list
|
|
25
|
+
expect(list).to be_a(Enumerable)
|
|
26
|
+
expect(list).to eq([{"id"=>"14", "name"=>"Group One", "size"=>"2", "status"=>"active", "type"=>"FilteredGroup"},
|
|
27
|
+
{"id"=>"91", "name"=>"Group Two", "size"=>"1", "status"=>"active", "type"=>"UploadedGroup"}])
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
describe 'create' do
|
|
32
|
+
let(:response_body) { fixture('groups/create.xml') }
|
|
33
|
+
|
|
34
|
+
before(:each) do
|
|
35
|
+
stub_upland_mobile_commons_request('create_group?name=Chocolate%20Lovers', method: :get).to_return(status: 200, body: response_body)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'should return success' do
|
|
39
|
+
resp = subject.create('Chocolate Lovers')
|
|
40
|
+
expect(resp.body['response']['success']).to be_truthy
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe UplandMobileCommonsRest::Profiles do
|
|
4
|
+
let(:client) { UplandMobileCommonsRest::Client.new(username: 'username', password: 'password') }
|
|
5
|
+
|
|
6
|
+
subject { UplandMobileCommonsRest::Profiles.new(client: client) }
|
|
7
|
+
|
|
8
|
+
it 'should initialize' do
|
|
9
|
+
expect(subject.client).to eq(client)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
context 'with credentials' do
|
|
13
|
+
let(:username) { 'username' }
|
|
14
|
+
let(:password) { 'password' }
|
|
15
|
+
|
|
16
|
+
describe 'update' do
|
|
17
|
+
before(:each) do
|
|
18
|
+
stub_upland_mobile_commons_request('profile_update', method: :post, body: 'phone_number=123-256-7890').
|
|
19
|
+
to_return(status: 200, body: response_body)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
context 'success' do
|
|
23
|
+
let(:response_body) { fixture('profiles/update.xml') }
|
|
24
|
+
|
|
25
|
+
it 'should succeed' do
|
|
26
|
+
resp = subject.update(phone_number: '123-256-7890')
|
|
27
|
+
expect(resp).to_not be_nil
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
context 'error' do
|
|
32
|
+
let(:response_body) { fixture('error.xml') }
|
|
33
|
+
|
|
34
|
+
it 'should raise' do
|
|
35
|
+
expect { subject.update(phone_number: '123-256-7890') }.to raise_error(UplandMobileCommonsRest::InvalidMessageBody)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
require 'upland_mobile_commons_rest'
|
|
5
|
+
require 'webmock/rspec'
|
|
6
|
+
|
|
7
|
+
# Require everything in the `support` directory
|
|
8
|
+
Dir[File.join(File.dirname(__FILE__), 'support', '**', '*.rb')].sort.each {|f| require f}
|
|
9
|
+
|
|
10
|
+
RSpec.configure do |config|
|
|
11
|
+
# Enable flags like --only-failures and --next-failure
|
|
12
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
|
13
|
+
|
|
14
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
|
15
|
+
config.disable_monkey_patching!
|
|
16
|
+
|
|
17
|
+
# Allow us to say 'describe Foo' instead of 'RSpec.describe Foo'
|
|
18
|
+
config.expose_dsl_globally = true
|
|
19
|
+
|
|
20
|
+
config.expect_with :rspec do |c|
|
|
21
|
+
c.syntax = :expect
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe UplandMobileCommonsRest do
|
|
6
|
+
it 'returns a client' do
|
|
7
|
+
client = UplandMobileCommonsRest.new(username: 'foo', password: 'bar')
|
|
8
|
+
expect(client).to be_an_instance_of(UplandMobileCommonsRest::Client)
|
|
9
|
+
expect(client.username).to eq('foo')
|
|
10
|
+
expect(client.password).to eq('bar')
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Generated by juwelier
|
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
+
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
|
+
# -*- encoding: utf-8 -*-
|
|
5
|
+
# stub: upland_mobile_commons_rest 0.0.1 ruby lib
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new do |s|
|
|
8
|
+
s.name = "upland_mobile_commons_rest".freeze
|
|
9
|
+
s.version = "0.0.1"
|
|
10
|
+
|
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
12
|
+
s.require_paths = ["lib".freeze]
|
|
13
|
+
s.authors = ["Nathan Woodhull".freeze]
|
|
14
|
+
s.date = "2020-06-09"
|
|
15
|
+
s.description = "A simple ruby API client gem for the Upland Mobile Commons REST API".freeze
|
|
16
|
+
s.email = "nathan@controlshiftlabs.com".freeze
|
|
17
|
+
s.extra_rdoc_files = [
|
|
18
|
+
"LICENSE.txt",
|
|
19
|
+
"README.md"
|
|
20
|
+
]
|
|
21
|
+
s.files = [
|
|
22
|
+
".document",
|
|
23
|
+
".rubocop.yml",
|
|
24
|
+
".travis.yml",
|
|
25
|
+
"CODE_OF_CONDUCT.md",
|
|
26
|
+
"Gemfile",
|
|
27
|
+
"Gemfile.lock",
|
|
28
|
+
"LICENSE.txt",
|
|
29
|
+
"README.md",
|
|
30
|
+
"Rakefile",
|
|
31
|
+
"VERSION",
|
|
32
|
+
"example.rb",
|
|
33
|
+
"lib/upland_mobile_commons_rest.rb",
|
|
34
|
+
"lib/upland_mobile_commons_rest/base.rb",
|
|
35
|
+
"lib/upland_mobile_commons_rest/campaigns.rb",
|
|
36
|
+
"lib/upland_mobile_commons_rest/client.rb",
|
|
37
|
+
"lib/upland_mobile_commons_rest/errors.rb",
|
|
38
|
+
"lib/upland_mobile_commons_rest/groups.rb",
|
|
39
|
+
"lib/upland_mobile_commons_rest/profiles.rb",
|
|
40
|
+
"spec/campaigns_spec.rb",
|
|
41
|
+
"spec/client_spec.rb",
|
|
42
|
+
"spec/fixtures/campaigns/list.xml",
|
|
43
|
+
"spec/fixtures/error.xml",
|
|
44
|
+
"spec/fixtures/groups/create.xml",
|
|
45
|
+
"spec/fixtures/groups/list.xml",
|
|
46
|
+
"spec/fixtures/profiles/update.xml",
|
|
47
|
+
"spec/group_spec.rb",
|
|
48
|
+
"spec/profiles_spec.rb",
|
|
49
|
+
"spec/spec_helper.rb",
|
|
50
|
+
"spec/support/fixtures.rb",
|
|
51
|
+
"spec/support/stub_requests.rb",
|
|
52
|
+
"spec/upland_mobile_commons_rest_spec.rb",
|
|
53
|
+
"upland_mobile_commons_rest.gemspec"
|
|
54
|
+
]
|
|
55
|
+
s.homepage = "http://github.com/controlshift/upland_mobile_commons_rest".freeze
|
|
56
|
+
s.licenses = ["MIT".freeze]
|
|
57
|
+
s.rubygems_version = "3.0.8".freeze
|
|
58
|
+
s.summary = "API client gem for Upland Mobile Commons".freeze
|
|
59
|
+
|
|
60
|
+
if s.respond_to? :specification_version then
|
|
61
|
+
s.specification_version = 4
|
|
62
|
+
|
|
63
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
64
|
+
s.add_runtime_dependency(%q<vertebrae>.freeze, [">= 0"])
|
|
65
|
+
s.add_development_dependency(%q<shoulda>.freeze, [">= 0"])
|
|
66
|
+
s.add_development_dependency(%q<rdoc>.freeze, ["> 3.12"])
|
|
67
|
+
s.add_development_dependency(%q<bundler>.freeze, ["> 2.0"])
|
|
68
|
+
s.add_development_dependency(%q<juwelier>.freeze, [">= 0"])
|
|
69
|
+
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
|
70
|
+
s.add_development_dependency(%q<dotenv>.freeze, [">= 0"])
|
|
71
|
+
s.add_development_dependency(%q<byebug>.freeze, [">= 0"])
|
|
72
|
+
s.add_development_dependency(%q<rubocop>.freeze, [">= 0"])
|
|
73
|
+
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
|
74
|
+
s.add_development_dependency(%q<webmock>.freeze, [">= 0"])
|
|
75
|
+
else
|
|
76
|
+
s.add_dependency(%q<vertebrae>.freeze, [">= 0"])
|
|
77
|
+
s.add_dependency(%q<shoulda>.freeze, [">= 0"])
|
|
78
|
+
s.add_dependency(%q<rdoc>.freeze, ["> 3.12"])
|
|
79
|
+
s.add_dependency(%q<bundler>.freeze, ["> 2.0"])
|
|
80
|
+
s.add_dependency(%q<juwelier>.freeze, [">= 0"])
|
|
81
|
+
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
|
82
|
+
s.add_dependency(%q<dotenv>.freeze, [">= 0"])
|
|
83
|
+
s.add_dependency(%q<byebug>.freeze, [">= 0"])
|
|
84
|
+
s.add_dependency(%q<rubocop>.freeze, [">= 0"])
|
|
85
|
+
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
|
86
|
+
s.add_dependency(%q<webmock>.freeze, [">= 0"])
|
|
87
|
+
end
|
|
88
|
+
else
|
|
89
|
+
s.add_dependency(%q<vertebrae>.freeze, [">= 0"])
|
|
90
|
+
s.add_dependency(%q<shoulda>.freeze, [">= 0"])
|
|
91
|
+
s.add_dependency(%q<rdoc>.freeze, ["> 3.12"])
|
|
92
|
+
s.add_dependency(%q<bundler>.freeze, ["> 2.0"])
|
|
93
|
+
s.add_dependency(%q<juwelier>.freeze, [">= 0"])
|
|
94
|
+
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
|
95
|
+
s.add_dependency(%q<dotenv>.freeze, [">= 0"])
|
|
96
|
+
s.add_dependency(%q<byebug>.freeze, [">= 0"])
|
|
97
|
+
s.add_dependency(%q<rubocop>.freeze, [">= 0"])
|
|
98
|
+
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
|
99
|
+
s.add_dependency(%q<webmock>.freeze, [">= 0"])
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
metadata
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: upland_mobile_commons_rest
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Nathan Woodhull
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2020-06-09 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: vertebrae
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: shoulda
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rdoc
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.12'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.12'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: bundler
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '2.0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '2.0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: juwelier
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: simplecov
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: dotenv
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: byebug
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: rubocop
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - ">="
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '0'
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - ">="
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: rspec
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '0'
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - ">="
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '0'
|
|
153
|
+
- !ruby/object:Gem::Dependency
|
|
154
|
+
name: webmock
|
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - ">="
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: '0'
|
|
160
|
+
type: :development
|
|
161
|
+
prerelease: false
|
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
+
requirements:
|
|
164
|
+
- - ">="
|
|
165
|
+
- !ruby/object:Gem::Version
|
|
166
|
+
version: '0'
|
|
167
|
+
description: A simple ruby API client gem for the Upland Mobile Commons REST API
|
|
168
|
+
email: nathan@controlshiftlabs.com
|
|
169
|
+
executables: []
|
|
170
|
+
extensions: []
|
|
171
|
+
extra_rdoc_files:
|
|
172
|
+
- LICENSE.txt
|
|
173
|
+
- README.md
|
|
174
|
+
files:
|
|
175
|
+
- ".document"
|
|
176
|
+
- ".rubocop.yml"
|
|
177
|
+
- ".travis.yml"
|
|
178
|
+
- CODE_OF_CONDUCT.md
|
|
179
|
+
- Gemfile
|
|
180
|
+
- Gemfile.lock
|
|
181
|
+
- LICENSE.txt
|
|
182
|
+
- README.md
|
|
183
|
+
- Rakefile
|
|
184
|
+
- VERSION
|
|
185
|
+
- example.rb
|
|
186
|
+
- lib/upland_mobile_commons_rest.rb
|
|
187
|
+
- lib/upland_mobile_commons_rest/base.rb
|
|
188
|
+
- lib/upland_mobile_commons_rest/campaigns.rb
|
|
189
|
+
- lib/upland_mobile_commons_rest/client.rb
|
|
190
|
+
- lib/upland_mobile_commons_rest/errors.rb
|
|
191
|
+
- lib/upland_mobile_commons_rest/groups.rb
|
|
192
|
+
- lib/upland_mobile_commons_rest/profiles.rb
|
|
193
|
+
- spec/campaigns_spec.rb
|
|
194
|
+
- spec/client_spec.rb
|
|
195
|
+
- spec/fixtures/campaigns/list.xml
|
|
196
|
+
- spec/fixtures/error.xml
|
|
197
|
+
- spec/fixtures/groups/create.xml
|
|
198
|
+
- spec/fixtures/groups/list.xml
|
|
199
|
+
- spec/fixtures/profiles/update.xml
|
|
200
|
+
- spec/group_spec.rb
|
|
201
|
+
- spec/profiles_spec.rb
|
|
202
|
+
- spec/spec_helper.rb
|
|
203
|
+
- spec/support/fixtures.rb
|
|
204
|
+
- spec/support/stub_requests.rb
|
|
205
|
+
- spec/upland_mobile_commons_rest_spec.rb
|
|
206
|
+
- upland_mobile_commons_rest.gemspec
|
|
207
|
+
homepage: http://github.com/controlshift/upland_mobile_commons_rest
|
|
208
|
+
licenses:
|
|
209
|
+
- MIT
|
|
210
|
+
metadata: {}
|
|
211
|
+
post_install_message:
|
|
212
|
+
rdoc_options: []
|
|
213
|
+
require_paths:
|
|
214
|
+
- lib
|
|
215
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
216
|
+
requirements:
|
|
217
|
+
- - ">="
|
|
218
|
+
- !ruby/object:Gem::Version
|
|
219
|
+
version: '0'
|
|
220
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
|
+
requirements:
|
|
222
|
+
- - ">="
|
|
223
|
+
- !ruby/object:Gem::Version
|
|
224
|
+
version: '0'
|
|
225
|
+
requirements: []
|
|
226
|
+
rubygems_version: 3.0.8
|
|
227
|
+
signing_key:
|
|
228
|
+
specification_version: 4
|
|
229
|
+
summary: API client gem for Upland Mobile Commons
|
|
230
|
+
test_files: []
|