upland_mobile_commons_rest 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/upland_mobile_commons_rest/groups.rb +17 -2
- data/spec/fixtures/error_profile_not_found.xml +3 -0
- data/spec/fixtures/profiles/get.xml +42 -0
- data/spec/group_spec.rb +41 -7
- data/upland_mobile_commons_rest.gemspec +5 -3
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 619f5d766058d364354c1c3209ac651a8b34428b893a9688242bb731cc518d03
|
4
|
+
data.tar.gz: c2484081c525f961a7604d6b43d1135de04f8a64dbbc4562ea64b5dcff9f6abe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f8d99f3d0ae8c47d2610d33a5b0b3f03a223a544d055843074cd83370076c0b808bd24dfd1c6bb433040b384144c86f1f16c247a63fef5b7616a1571f87d3a2
|
7
|
+
data.tar.gz: 6a48dea9cd8e1986f0eada1f54b05fd6b3e02de71024158a79633134fda6e2df45ad097a07c33b0db21f697a1af3107ebc46b8dad1a2315b9c7fc6f0d49bd7d7
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -5,8 +5,23 @@ module UplandMobileCommonsRest
|
|
5
5
|
'groups'
|
6
6
|
end
|
7
7
|
|
8
|
-
def list
|
9
|
-
|
8
|
+
def list(page: nil, limit: nil)
|
9
|
+
params = []
|
10
|
+
|
11
|
+
if page
|
12
|
+
params << "page=#{url_escape(page)}"
|
13
|
+
end
|
14
|
+
|
15
|
+
if limit
|
16
|
+
params << "limit=#{url_escape(limit)}"
|
17
|
+
end
|
18
|
+
|
19
|
+
request_path = base_path
|
20
|
+
if params.any?
|
21
|
+
request_path += "?#{params.join('&')}"
|
22
|
+
end
|
23
|
+
|
24
|
+
resp = client.get_request(request_path)
|
10
25
|
resp.body['response']['groups']['group']
|
11
26
|
end
|
12
27
|
|
@@ -0,0 +1,42 @@
|
|
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></integrations>
|
40
|
+
<clicks></clicks>
|
41
|
+
</profile>
|
42
|
+
</response>
|
data/spec/group_spec.rb
CHANGED
@@ -16,15 +16,49 @@ describe UplandMobileCommonsRest::Groups do
|
|
16
16
|
describe 'list' do
|
17
17
|
let(:response_body) { fixture('groups/list.xml') }
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
context 'unpaginated request' do
|
20
|
+
before(:each) do
|
21
|
+
stub_upland_mobile_commons_request('groups', method: :get).to_return(status: 200, body: response_body)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should return a list of groups' do
|
25
|
+
list = subject.list
|
26
|
+
expect(list).to be_a(Enumerable)
|
27
|
+
expect(list).to eq([{"id"=>"14", "name"=>"Group One", "size"=>"2", "status"=>"active", "type"=>"FilteredGroup"},
|
28
|
+
{"id"=>"91", "name"=>"Group Two", "size"=>"1", "status"=>"active", "type"=>"UploadedGroup"}])
|
29
|
+
end
|
21
30
|
end
|
22
31
|
|
23
|
-
|
24
|
-
list
|
25
|
-
|
26
|
-
|
27
|
-
|
32
|
+
context 'paginated request' do
|
33
|
+
it 'should return a list of groups when both parameters provided' do
|
34
|
+
stub_upland_mobile_commons_request('groups?limit=50&page=35', method: :get).to_return(status: 200, body: response_body)
|
35
|
+
|
36
|
+
list = subject.list(page: 35, limit: 50)
|
37
|
+
|
38
|
+
expect(list).to be_a(Enumerable)
|
39
|
+
expect(list).to eq([{"id"=>"14", "name"=>"Group One", "size"=>"2", "status"=>"active", "type"=>"FilteredGroup"},
|
40
|
+
{"id"=>"91", "name"=>"Group Two", "size"=>"1", "status"=>"active", "type"=>"UploadedGroup"}])
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should return a list of groups when only limit parameter provided' do
|
44
|
+
stub_upland_mobile_commons_request('groups?limit=50', method: :get).to_return(status: 200, body: response_body)
|
45
|
+
|
46
|
+
list = subject.list(limit: 50)
|
47
|
+
|
48
|
+
expect(list).to be_a(Enumerable)
|
49
|
+
expect(list).to eq([{"id"=>"14", "name"=>"Group One", "size"=>"2", "status"=>"active", "type"=>"FilteredGroup"},
|
50
|
+
{"id"=>"91", "name"=>"Group Two", "size"=>"1", "status"=>"active", "type"=>"UploadedGroup"}])
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should return a list of groups when only page parameter provided' do
|
54
|
+
stub_upland_mobile_commons_request('groups?page=35', method: :get).to_return(status: 200, body: response_body)
|
55
|
+
|
56
|
+
list = subject.list(page: 35)
|
57
|
+
|
58
|
+
expect(list).to be_a(Enumerable)
|
59
|
+
expect(list).to eq([{"id"=>"14", "name"=>"Group One", "size"=>"2", "status"=>"active", "type"=>"FilteredGroup"},
|
60
|
+
{"id"=>"91", "name"=>"Group Two", "size"=>"1", "status"=>"active", "type"=>"UploadedGroup"}])
|
61
|
+
end
|
28
62
|
end
|
29
63
|
end
|
30
64
|
|
@@ -2,16 +2,16 @@
|
|
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.1.
|
5
|
+
# stub: upland_mobile_commons_rest 0.1.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "upland_mobile_commons_rest".freeze
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.2"
|
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]
|
13
13
|
s.authors = ["Nathan Woodhull".freeze]
|
14
|
-
s.date = "2020-
|
14
|
+
s.date = "2020-10-13"
|
15
15
|
s.description = "A simple ruby API client gem for the Upland Mobile Commons REST API".freeze
|
16
16
|
s.email = "nathan@controlshiftlabs.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -41,8 +41,10 @@ Gem::Specification.new do |s|
|
|
41
41
|
"spec/client_spec.rb",
|
42
42
|
"spec/fixtures/campaigns/list.xml",
|
43
43
|
"spec/fixtures/error.xml",
|
44
|
+
"spec/fixtures/error_profile_not_found.xml",
|
44
45
|
"spec/fixtures/groups/create.xml",
|
45
46
|
"spec/fixtures/groups/list.xml",
|
47
|
+
"spec/fixtures/profiles/get.xml",
|
46
48
|
"spec/fixtures/profiles/update.xml",
|
47
49
|
"spec/group_spec.rb",
|
48
50
|
"spec/profiles_spec.rb",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upland_mobile_commons_rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Woodhull
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vertebrae
|
@@ -194,8 +194,10 @@ files:
|
|
194
194
|
- spec/client_spec.rb
|
195
195
|
- spec/fixtures/campaigns/list.xml
|
196
196
|
- spec/fixtures/error.xml
|
197
|
+
- spec/fixtures/error_profile_not_found.xml
|
197
198
|
- spec/fixtures/groups/create.xml
|
198
199
|
- spec/fixtures/groups/list.xml
|
200
|
+
- spec/fixtures/profiles/get.xml
|
199
201
|
- spec/fixtures/profiles/update.xml
|
200
202
|
- spec/group_spec.rb
|
201
203
|
- spec/profiles_spec.rb
|
@@ -208,7 +210,7 @@ homepage: http://github.com/controlshift/upland_mobile_commons_rest
|
|
208
210
|
licenses:
|
209
211
|
- MIT
|
210
212
|
metadata: {}
|
211
|
-
post_install_message:
|
213
|
+
post_install_message:
|
212
214
|
rdoc_options: []
|
213
215
|
require_paths:
|
214
216
|
- lib
|
@@ -224,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
226
|
version: '0'
|
225
227
|
requirements: []
|
226
228
|
rubygems_version: 3.0.8
|
227
|
-
signing_key:
|
229
|
+
signing_key:
|
228
230
|
specification_version: 4
|
229
231
|
summary: API client gem for Upland Mobile Commons
|
230
232
|
test_files: []
|