mobilize-america-client 0.3.2 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 373afa31bbc987e9e983ac6bb3c201a9754323cd5cbdb3a3f7f1a560a0a1fa02
4
- data.tar.gz: 476d9ad2e93bac801c68ccd476e152c005a30fe0b009eb7a2699bd3fda842466
3
+ metadata.gz: 9a8aa2a6520cae7a352ffabce99976284b1348b63f16cdc29d9933fb7b5b0881
4
+ data.tar.gz: d5a2a05390fc6f003042d345a16a2bf903cce4e130347207581f2b7ae5178863
5
5
  SHA512:
6
- metadata.gz: 6a323bd1ce0da923c45a749527ba0203091d3a67879eb740bce8b11d405a8db973ae155a3d945a69b9c9e55dd807976a2e4edc84aa213856c52e7d8397d82ce6
7
- data.tar.gz: 7205662fa25f426b0b80dbdef296d39b1c6c3d015e17f92439f42b798ba0a86228fb6c1b4806e43d0b2567592fd4c4f60b73bc40c263e47a1ba32560804c2528
6
+ metadata.gz: a58a2cbc1e069b67a845e16db9a8e4954b63b9fb2f0842cf9fc4913974ca9589e16c6fc7d13e767e1b8837cf9711f85e7358e917ad555c53e17d8fd321142ff9
7
+ data.tar.gz: c0995119c306cb4e1e96478401a3b91630a52c88990b72c1fe13ce137bd85c5cfe97c8aefbc991c6f601212b420f2d8554a1adfc02a66a3eafebc305fcb3c52d
@@ -0,0 +1,24 @@
1
+ name: CI
2
+ on: [push]
3
+
4
+ jobs:
5
+ test:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - uses: actions/checkout@v2
9
+ - uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
10
+ with:
11
+ ruby-version: 2.7
12
+ bundler-cache: true
13
+ - run: bundle install
14
+ - run: bundle exec rspec
15
+ rubocop:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+ - uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
20
+ with:
21
+ ruby-version: 2.7
22
+ bundler-cache: true
23
+ - run: bundle install
24
+ - run: bundle exec rubocop
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ mobilize_america_client
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.4
data/Gemfile CHANGED
@@ -4,8 +4,10 @@ gem 'faraday', '> 0.15'
4
4
 
5
5
  group :development do
6
6
  gem 'rspec'
7
- gem 'juwelier'
7
+ gem 'juwelier', git: 'https://github.com/flajann2/juwelier.git'
8
8
  gem 'rake'
9
9
  gem 'webmock'
10
10
  gem 'rubocop'
11
+ gem 'dotenv'
12
+ gem 'byebug'
11
13
  end
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # MobilizeAmericaClient::Client
2
2
 
3
+ [![CI Status](https://github.com/controlshift/mobilize_america_client/actions/workflows/ci.yml/badge.svg)](https://github.com/controlshift/mobilize_america_client/actions/workflows/ci.yml)
4
+
3
5
  A minimalist API client for the [MobilizeAmerica API](https://github.com/mobilizeamerica/api):
4
6
 
5
7
  ## Installation
@@ -18,11 +20,29 @@ Or install it yourself as:
18
20
 
19
21
  $ gem install mobilize-america-client
20
22
 
23
+ ## Configuration
24
+
25
+ By default, the client accesses the public production instance without authentication.
26
+
27
+ `client = MobilizeAmericaClient::Client.new`
28
+
29
+ It is also possible to provide an API key to the client to make authenticated requests, or to specify
30
+ other endpoints.
31
+
32
+ `client = MobilizeAmericaClient::Client.new(api_key: 'abc123', api_domain: 'staging-api.mobilize.us')`
33
+
34
+
21
35
  ## Usage
22
36
 
23
- For now, the gem only supports listing an organization's events.
37
+ Retrieve a list of organizations
38
+ `client.organizations(page: 2, per_page: 50)`
39
+
40
+
41
+ Retrieve a list of an organization's events
42
+ `client.organization_events(organization_id: 123)`
24
43
 
25
- `MobilizeAmericaClient::Client.new.organization_events(organization_id: 123)`
44
+ Retrieve a specific event
45
+ `client.organization_event(organization_id: 123, event_id: 123)`
26
46
 
27
47
 
28
48
  ## Development
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.6
data/example.rb ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'mobilize_america_client'
4
+ require 'dotenv'
5
+ require 'byebug'
6
+
7
+ Dotenv.load('.env')
8
+
9
+ client = MobilizeAmericaClient::Client.new(api_key: ENV['API_KEY'], api_domain: ENV['API_DOMAIN']) # rubocop:disable Lint/UselessAssignment
10
+
11
+ puts "Ready to call Mobilize America using 'client' object"
12
+ byebug # rubocop:disable Lint/Debugger
13
+
14
+ puts "Bye!"
@@ -1,8 +1,8 @@
1
1
  module MobilizeAmericaClient
2
2
  class Client
3
3
  module Events
4
- def organization_events(organization_id:, updated_since: nil, max_distance_miles: nil, page: nil, per_page: nil,
5
- zipcode: nil)
4
+ def organization_events(organization_id:, timeslot_start: nil, timeslot_end: nil, updated_since: nil,
5
+ max_distance_miles: nil, page: nil, per_page: nil, zipcode: nil)
6
6
  params = {}
7
7
 
8
8
  unless page.nil?
@@ -13,6 +13,14 @@ module MobilizeAmericaClient
13
13
  params[:per_page] = per_page
14
14
  end
15
15
 
16
+ unless timeslot_start.nil?
17
+ params[:timeslot_start] = timeslot_start
18
+ end
19
+
20
+ unless timeslot_end.nil?
21
+ params[:timeslot_end] = timeslot_end
22
+ end
23
+
16
24
  unless updated_since.nil?
17
25
  params[:updated_since] = updated_since.to_i
18
26
  end
@@ -28,5 +36,9 @@ module MobilizeAmericaClient
28
36
  get(path: "/organizations/#{esc(organization_id)}/events", params: params)
29
37
  end
30
38
  end
39
+
40
+ def organization_event(organization_id:, event_id:)
41
+ get(path: "/organizations/#{esc(organization_id)}/events/#{esc(event_id)}")
42
+ end
31
43
  end
32
44
  end
@@ -0,0 +1,23 @@
1
+ module MobilizeAmericaClient
2
+ class Client
3
+ module Organizations
4
+ def organizations(page: nil, per_page: nil, updated_since: nil)
5
+ params = {}
6
+
7
+ unless page.nil?
8
+ params[:page] = page
9
+ end
10
+
11
+ unless per_page.nil?
12
+ params[:per_page] = per_page
13
+ end
14
+
15
+ unless updated_since.nil?
16
+ params[:updated_since] = updated_since.to_i
17
+ end
18
+
19
+ get(path: "/organizations", params: params)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,16 +1,24 @@
1
1
  require 'faraday'
2
2
  require 'mobilize_america_client/client/events'
3
+ require 'mobilize_america_client/client/organizations'
3
4
  require 'mobilize_america_client/request'
5
+ require 'mobilize_america_client/errors'
4
6
 
5
7
  module MobilizeAmericaClient
6
8
  class Client
7
9
  attr_reader :connection
10
+ attr_accessor :api_key
8
11
 
9
- def initialize
10
- @connection = Faraday.new(url: "https://#{API_DOMAIN}")
12
+ def initialize(options = {})
13
+ self.api_key = options[:api_key]
14
+
15
+ api_domain = options[:api_domain] || API_DOMAIN
16
+
17
+ @connection = Faraday.new(url: "https://#{api_domain}")
11
18
  end
12
19
 
13
20
  include MobilizeAmericaClient::Request
14
21
  include MobilizeAmericaClient::Client::Events
22
+ include MobilizeAmericaClient::Client::Organizations
15
23
  end
16
24
  end
@@ -0,0 +1,4 @@
1
+ module MobilizeAmericaClient
2
+ class NotFoundError < StandardError
3
+ end
4
+ end
@@ -20,9 +20,18 @@ module MobilizeAmericaClient
20
20
  req.path = "#{API_BASE_PATH}#{path}"
21
21
  req.params = params
22
22
  req.headers['Content-Type'] = 'application/json'
23
+
24
+ unless api_key.nil?
25
+ req.headers['Authorization'] = "Bearer #{api_key}"
26
+ end
27
+
23
28
  req.body = ::JSON.generate(body) unless body.empty?
24
29
  end
25
30
 
31
+ if response.status == 404
32
+ raise MobilizeAmericaClient::NotFoundError
33
+ end
34
+
26
35
  JSON.parse(response.body)
27
36
  end
28
37
  end
@@ -2,8 +2,8 @@ require 'mobilize_america_client/client'
2
2
 
3
3
  module MobilizeAmerica
4
4
  class << self
5
- def new
6
- MobilizeAmericaClient::Client.new
5
+ def new(options = {})
6
+ MobilizeAmericaClient::Client.new(options)
7
7
  end
8
8
  end
9
9
  end
@@ -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: mobilize-america-client 0.3.2 ruby lib
5
+ # stub: mobilize-america-client 0.3.6 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "mobilize-america-client".freeze
9
- s.version = "0.3.2"
9
+ s.version = "0.3.6"
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 = ["Grey Moore".freeze]
14
- s.date = "2020-05-08"
14
+ s.date = "2021-09-14"
15
15
  s.email = "grey@controlshiftlabs.com".freeze
16
16
  s.executables = ["console".freeze, "setup".freeze]
17
17
  s.extra_rdoc_files = [
@@ -20,9 +20,11 @@ Gem::Specification.new do |s|
20
20
  "README.md"
21
21
  ]
22
22
  s.files = [
23
+ ".github/workflows/ci.yml",
23
24
  ".rspec",
24
25
  ".rubocop.yml",
25
- ".travis.yml",
26
+ ".ruby-gemset",
27
+ ".ruby-version",
26
28
  "CODE_OF_CONDUCT.md",
27
29
  "Gemfile",
28
30
  "LICENSE",
@@ -32,17 +34,23 @@ Gem::Specification.new do |s|
32
34
  "VERSION",
33
35
  "bin/console",
34
36
  "bin/setup",
37
+ "example.rb",
35
38
  "lib/mobilize_america_client.rb",
36
39
  "lib/mobilize_america_client/client.rb",
37
40
  "lib/mobilize_america_client/client/events.rb",
41
+ "lib/mobilize_america_client/client/organizations.rb",
42
+ "lib/mobilize_america_client/errors.rb",
38
43
  "lib/mobilize_america_client/request.rb",
39
44
  "mobilize-america-client.gemspec",
45
+ "spec/client/client_spec.rb",
40
46
  "spec/client/events_spec.rb",
47
+ "spec/client/organizations_spec.rb",
48
+ "spec/fixtures/organizations.json",
41
49
  "spec/spec_helper.rb"
42
50
  ]
43
51
  s.homepage = "http://github.com/controlshift/mobilize_america_client".freeze
44
52
  s.licenses = ["MIT".freeze]
45
- s.rubygems_version = "3.0.4".freeze
53
+ s.rubygems_version = "3.0.9".freeze
46
54
  s.summary = "Client gem for the MobilizeAmerica API".freeze
47
55
 
48
56
  if s.respond_to? :specification_version then
@@ -55,6 +63,8 @@ Gem::Specification.new do |s|
55
63
  s.add_development_dependency(%q<rake>.freeze, [">= 0"])
56
64
  s.add_development_dependency(%q<webmock>.freeze, [">= 0"])
57
65
  s.add_development_dependency(%q<rubocop>.freeze, [">= 0"])
66
+ s.add_development_dependency(%q<dotenv>.freeze, [">= 0"])
67
+ s.add_development_dependency(%q<byebug>.freeze, [">= 0"])
58
68
  else
59
69
  s.add_dependency(%q<faraday>.freeze, ["> 0.15"])
60
70
  s.add_dependency(%q<rspec>.freeze, [">= 0"])
@@ -62,6 +72,8 @@ Gem::Specification.new do |s|
62
72
  s.add_dependency(%q<rake>.freeze, [">= 0"])
63
73
  s.add_dependency(%q<webmock>.freeze, [">= 0"])
64
74
  s.add_dependency(%q<rubocop>.freeze, [">= 0"])
75
+ s.add_dependency(%q<dotenv>.freeze, [">= 0"])
76
+ s.add_dependency(%q<byebug>.freeze, [">= 0"])
65
77
  end
66
78
  else
67
79
  s.add_dependency(%q<faraday>.freeze, ["> 0.15"])
@@ -70,6 +82,8 @@ Gem::Specification.new do |s|
70
82
  s.add_dependency(%q<rake>.freeze, [">= 0"])
71
83
  s.add_dependency(%q<webmock>.freeze, [">= 0"])
72
84
  s.add_dependency(%q<rubocop>.freeze, [">= 0"])
85
+ s.add_dependency(%q<dotenv>.freeze, [">= 0"])
86
+ s.add_dependency(%q<byebug>.freeze, [">= 0"])
73
87
  end
74
88
  end
75
89
 
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe MobilizeAmericaClient::Client do
4
+ subject { MobilizeAmericaClient::Client.new(api_key: 'abc123') }
5
+
6
+ it 'should set the api_key' do
7
+ expect(subject.api_key).to eq('abc123')
8
+ end
9
+ end
@@ -12,23 +12,46 @@ RSpec.describe MobilizeAmericaClient::Client::Events do
12
12
  let(:events_url) { "#{base_url}/organizations/#{org_id}/events" }
13
13
  let(:response) { {'data' => [{'id' => 1, 'description' => 'event 1'}, {'id' => 2, 'description' => 'event 2'}]} }
14
14
 
15
+ it 'should raise if response status is 404' do
16
+ stub_request(:get, events_url).with(headers: standard_headers).to_return(status: 404, body: {error: 'not found'}.to_json)
17
+
18
+ expect { subject.organization_events(organization_id: org_id) }.to raise_error MobilizeAmericaClient::NotFoundError
19
+ end
20
+
15
21
  it 'should call the endpoint and return JSON' do
16
22
  stub_request(:get, events_url).with(headers: standard_headers).to_return(body: response.to_json)
17
- expect(subject.organization_events(organization_id: org_id)).to eq response
23
+ expect(subject.organization_events(organization_id: org_id)).to eq(response)
18
24
  end
19
25
 
20
26
  it 'should escape the organization ID' do
21
27
  expected_url = "#{base_url}/organizations/foo%2Fbar/events"
22
28
  stub_request(:get, expected_url).with(headers: standard_headers).to_return(body: response.to_json)
23
- expect(subject.organization_events(organization_id: 'foo/bar')).to eq response
29
+ expect(subject.organization_events(organization_id: 'foo/bar')).to eq(response)
30
+ end
31
+
32
+ it 'should support a timeslot_start parameter' do
33
+ timeslot_start = "gte_#{Time.new.to_i}"
34
+ stub_request(:get, events_url)
35
+ .with(headers: standard_headers, query: {timeslot_start: timeslot_start})
36
+ .to_return(body: response.to_json)
37
+ expect(subject.organization_events(organization_id: org_id, timeslot_start: timeslot_start)).to eq response
24
38
  end
25
39
 
40
+ it 'should support a timeslot_end parameter' do
41
+ timeslot_end = "gte_#{Time.new.to_i}"
42
+ stub_request(:get, events_url)
43
+ .with(headers: standard_headers, query: {timeslot_end: timeslot_end})
44
+ .to_return(body: response.to_json)
45
+ expect(subject.organization_events(organization_id: org_id, timeslot_end: timeslot_end)).to eq response
46
+ end
47
+
48
+
26
49
  it 'should support an updated_since parameter' do
27
50
  updated_since = Time.new
28
51
  stub_request(:get, events_url)
29
52
  .with(headers: standard_headers, query: {updated_since: updated_since.to_i})
30
53
  .to_return(body: response.to_json)
31
- expect(subject.organization_events(organization_id: org_id, updated_since: updated_since)).to eq response
54
+ expect(subject.organization_events(organization_id: org_id, updated_since: updated_since)).to eq(response)
32
55
  end
33
56
 
34
57
  it 'should support a zipcode parameter' do
@@ -36,21 +59,35 @@ RSpec.describe MobilizeAmericaClient::Client::Events do
36
59
  stub_request(:get, events_url)
37
60
  .with(headers: standard_headers, query: {zipcode: zipcode})
38
61
  .to_return(body: response.to_json)
39
- expect(subject.organization_events(organization_id: org_id, zipcode: zipcode)).to eq response
62
+ expect(subject.organization_events(organization_id: org_id, zipcode: zipcode)).to eq(response)
40
63
  end
41
64
 
42
65
  it 'should support a max_dist parameter to go with zipcode' do
43
66
  stub_request(:get, events_url)
44
67
  .with(headers: standard_headers, query: {zipcode: '23456', max_dist: 100})
45
68
  .to_return(body: response.to_json)
46
- expect(subject.organization_events(organization_id: org_id, zipcode: '23456', max_distance_miles: 100)).to eq response
69
+ expect(subject.organization_events(organization_id: org_id, zipcode: '23456', max_distance_miles: 100)).to eq(response)
47
70
  end
48
71
 
49
72
  it 'should support pagination parameters' do
50
73
  stub_request(:get, events_url)
51
74
  .with(headers: standard_headers, query: {page: 2, per_page: 100})
52
75
  .to_return(body: response.to_json)
53
- expect(subject.organization_events(organization_id: org_id, page: 2, per_page: 100)).to eq response
76
+ expect(subject.organization_events(organization_id: org_id, page: 2, per_page: 100)).to eq(response)
77
+ end
78
+ end
79
+
80
+ describe '#organization_event' do
81
+ let(:org_id) { 123 }
82
+ let(:event_id) { 456 }
83
+ let(:events_url) { "#{base_url}/organizations/#{org_id}/events/#{event_id}" }
84
+ let(:response) { '{"hello": "world"}' }
85
+
86
+ it 'should support pagination parameters' do
87
+ stub_request(:get, events_url)
88
+ .with(headers: standard_headers)
89
+ .to_return(body: response.to_json)
90
+ expect(subject.organization_event(organization_id: org_id, event_id: event_id)).to eq(response)
54
91
  end
55
92
  end
56
93
  end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe MobilizeAmericaClient::Client::Organizations do
4
+ let(:standard_headers) { {'Content-Type' => 'application/json'} }
5
+
6
+ subject { MobilizeAmericaClient::Client.new }
7
+
8
+ let(:base_url) { "https://#{MobilizeAmericaClient::Client::API_DOMAIN}#{MobilizeAmericaClient::Client::API_BASE_PATH}" }
9
+
10
+ describe '#organizations' do
11
+ let(:organizations_url) { "#{base_url}/organizations" }
12
+ let(:response) { fixture('organizations.json').read }
13
+
14
+ it 'should call the endpoint and return JSON' do
15
+ stub_request(:get, organizations_url).with(headers: standard_headers).to_return(body: response.to_json)
16
+ expect(subject.organizations).to eq response
17
+ end
18
+ end
19
+ end
@@ -0,0 +1 @@
1
+ {"count":3989,"next":"https://www.mobilize.us/api/v1/organizations?page=3","previous":"https://www.mobilize.us/api/v1/organizations","data":[{"modified_date":1600715164,"slug":"seiu","is_independent":false,"id":116,"created_date":1513974471,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/seiu/","name":"SEIU Members","state":"","district":"","org_type":"UNION","is_coordinated":true,"candidate_name":""},{"modified_date":1600715089,"slug":"texas-democratic-women","is_independent":false,"id":126,"created_date":1513974768,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/texas-democratic-women/","name":"Texas Democratic Women","state":"TX","district":"","org_type":"CAMPAIGN","is_coordinated":true,"candidate_name":""},{"modified_date":1600715182,"slug":"tsta","is_independent":false,"id":137,"created_date":1513974907,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/tsta/","name":"Texas State Teachers Association","state":"TX","district":"","org_type":"UNION","is_coordinated":true,"candidate_name":""},{"modified_date":1601329106,"slug":"julieoliverforcongress","is_independent":false,"id":152,"created_date":1515604602,"is_primary_campaign":false,"race_type":"CONGRESSIONAL","event_feed_url":"https://www.mobilize.us/julieoliverforcongress/","name":"Julie Oliver for Congress","state":"TX","district":"25","org_type":"CAMPAIGN","is_coordinated":true,"candidate_name":"Julie Oliver"},{"modified_date":1600715175,"slug":"estevez-fl-staterep","is_independent":false,"id":153,"created_date":1515696035,"is_primary_campaign":true,"race_type":null,"event_feed_url":"https://www.mobilize.us/estevez-fl-staterep/","name":"Javier Estevez for FL State Rep","state":"","district":"","org_type":"CAMPAIGN","is_coordinated":true,"candidate_name":""},{"modified_date":1600715167,"slug":"dpva","is_independent":false,"id":156,"created_date":1516662305,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/dpva/","name":"Democratic Party of Virginia","state":"","district":"","org_type":"PARTY_COMMITTEE","is_coordinated":true,"candidate_name":""},{"modified_date":1601478320,"slug":"ppaf","is_independent":false,"id":157,"created_date":1516720901,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/ppaf/","name":"Planned Parenthood Action Fund","state":"","district":"","org_type":"C4","is_coordinated":true,"candidate_name":""},{"modified_date":1600715096,"slug":"lambforcongress","is_independent":false,"id":158,"created_date":1516983917,"is_primary_campaign":false,"race_type":"CONGRESSIONAL","event_feed_url":"https://www.mobilize.us/lambforcongress/","name":"Conor Lamb for Congress","state":"PA","district":"17","org_type":"CAMPAIGN","is_coordinated":true,"candidate_name":"Conor Lamb"},{"modified_date":1601057120,"slug":"swingleft","is_independent":false,"id":159,"created_date":1516984264,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/swingleft/","name":"Swing Left","state":"","district":"","org_type":"COORDINATED","is_coordinated":true,"candidate_name":""},{"modified_date":1601564563,"slug":"obama4congress","is_independent":false,"id":160,"created_date":1517244783,"is_primary_campaign":true,"race_type":null,"event_feed_url":"https://www.mobilize.us/obama4congress/","name":"Obama for Congress","state":"","district":"","org_type":"COORDINATED","is_coordinated":true,"candidate_name":""},{"modified_date":1600715131,"slug":"codebluewla","is_independent":false,"id":161,"created_date":1517247865,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/codebluewla/","name":"Code Blue WLA","state":"","district":"","org_type":"COORDINATED","is_coordinated":true,"candidate_name":""},{"modified_date":1600715129,"slug":"time-for-action","is_independent":true,"id":162,"created_date":1517256375,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/time-for-action/","name":"Time For Action","state":"","district":"","org_type":"INDEPENDENT","is_coordinated":false,"candidate_name":""},{"modified_date":1600715116,"slug":"hrc-supervols","is_independent":false,"id":163,"created_date":1517267855,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/hrc-supervols/","name":"HRC Supervols","state":"","district":"","org_type":"COORDINATED","is_coordinated":true,"candidate_name":""},{"modified_date":1600715131,"slug":"aapivf","is_independent":true,"id":164,"created_date":1517433620,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/aapivf/","name":"AAPI Victory Fund","state":"","district":"","org_type":"INDEPENDENT","is_coordinated":false,"candidate_name":""},{"modified_date":1600715151,"slug":"together-we-will","is_independent":true,"id":166,"created_date":1517956677,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/together-we-will/","name":"Together We Will","state":"","district":"","org_type":"INDEPENDENT","is_coordinated":false,"candidate_name":""},{"modified_date":1600715131,"slug":"action-together-network","is_independent":true,"id":168,"created_date":1517956678,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/action-together-network/","name":"Action Together Network","state":"","district":"","org_type":"INDEPENDENT","is_coordinated":false,"candidate_name":""},{"modified_date":1600715109,"slug":"hrc","is_independent":false,"id":173,"created_date":1517956678,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/hrc/","name":"Human Rights Campaign","state":"","district":"","org_type":"C4","is_coordinated":true,"candidate_name":""},{"modified_date":1601392232,"slug":"nextgenva","is_independent":true,"id":175,"created_date":1517956678,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/nextgenva/","name":"NextGen VA","state":"VA","district":"","org_type":"C4","is_coordinated":false,"candidate_name":""},{"modified_date":1600715139,"slug":"jesskingforcongress","is_independent":false,"id":177,"created_date":1517961417,"is_primary_campaign":false,"race_type":"CONGRESSIONAL","event_feed_url":"https://www.mobilize.us/jesskingforcongress/","name":"Jess King for Congress","state":"PA","district":"11","org_type":"CAMPAIGN","is_coordinated":true,"candidate_name":"Jess King"},{"modified_date":1600715160,"slug":"bluefuture","is_independent":false,"id":178,"created_date":1518035163,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/bluefuture/","name":"Blue Future","state":"","district":"","org_type":"COORDINATED","is_coordinated":true,"candidate_name":""},{"modified_date":1601392569,"slug":"standupamerica","is_independent":true,"id":183,"created_date":1519324166,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/standupamerica/","name":"Stand Up America","state":"","district":"","org_type":"C4","is_coordinated":false,"candidate_name":""},{"modified_date":1600715152,"slug":"reclaimidaho","is_independent":false,"id":185,"created_date":1519689388,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/reclaimidaho/","name":"Reclaim Idaho","state":"ID","district":"","org_type":"C4","is_coordinated":true,"candidate_name":""},{"modified_date":1600715183,"slug":"elissaforcongress","is_independent":false,"id":186,"created_date":1519925164,"is_primary_campaign":false,"race_type":"CONGRESSIONAL","event_feed_url":"https://www.mobilize.us/elissaforcongress/","name":"Elissa Slotkin for Congress","state":"MI","district":"8","org_type":"CAMPAIGN","is_coordinated":true,"candidate_name":"Elissa Slotkin"},{"modified_date":1600715165,"slug":"ohdems","is_independent":false,"id":187,"created_date":1519939100,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/ohdems/","name":"Ohio Democratic Party","state":"OH","district":"","org_type":"PARTY_COMMITTEE","is_coordinated":true,"candidate_name":""},{"modified_date":1600715094,"slug":"networknova","is_independent":false,"id":188,"created_date":1520014124,"is_primary_campaign":false,"race_type":null,"event_feed_url":"https://www.mobilize.us/networknova/","name":"Network NoVA","state":"","district":"","org_type":"COORDINATED","is_coordinated":true,"candidate_name":""}],"metadata":{"url_name":"public_organizations","build_commit":"e1b1c2e948f0c78571b3eee294d7946812b0ce1b","page_title":null},"is_custom_domain":false}
data/spec/spec_helper.rb CHANGED
@@ -27,3 +27,11 @@ RSpec.configure do |config|
27
27
  WebMock.reset!
28
28
  end
29
29
  end
30
+
31
+ def fixture_path
32
+ File.expand_path("../fixtures", __FILE__)
33
+ end
34
+
35
+ def fixture(file)
36
+ File.new(File.join(fixture_path, '/', file))
37
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobilize-america-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grey Moore
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-08 00:00:00.000000000 Z
11
+ date: 2021-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -94,7 +94,35 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- description:
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
+ description:
98
126
  email: grey@controlshiftlabs.com
99
127
  executables:
100
128
  - console
@@ -105,9 +133,11 @@ extra_rdoc_files:
105
133
  - LICENSE.txt
106
134
  - README.md
107
135
  files:
136
+ - ".github/workflows/ci.yml"
108
137
  - ".rspec"
109
138
  - ".rubocop.yml"
110
- - ".travis.yml"
139
+ - ".ruby-gemset"
140
+ - ".ruby-version"
111
141
  - CODE_OF_CONDUCT.md
112
142
  - Gemfile
113
143
  - LICENSE
@@ -117,18 +147,24 @@ files:
117
147
  - VERSION
118
148
  - bin/console
119
149
  - bin/setup
150
+ - example.rb
120
151
  - lib/mobilize_america_client.rb
121
152
  - lib/mobilize_america_client/client.rb
122
153
  - lib/mobilize_america_client/client/events.rb
154
+ - lib/mobilize_america_client/client/organizations.rb
155
+ - lib/mobilize_america_client/errors.rb
123
156
  - lib/mobilize_america_client/request.rb
124
157
  - mobilize-america-client.gemspec
158
+ - spec/client/client_spec.rb
125
159
  - spec/client/events_spec.rb
160
+ - spec/client/organizations_spec.rb
161
+ - spec/fixtures/organizations.json
126
162
  - spec/spec_helper.rb
127
163
  homepage: http://github.com/controlshift/mobilize_america_client
128
164
  licenses:
129
165
  - MIT
130
166
  metadata: {}
131
- post_install_message:
167
+ post_install_message:
132
168
  rdoc_options: []
133
169
  require_paths:
134
170
  - lib
@@ -143,8 +179,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
179
  - !ruby/object:Gem::Version
144
180
  version: '0'
145
181
  requirements: []
146
- rubygems_version: 3.0.4
147
- signing_key:
182
+ rubygems_version: 3.1.6
183
+ signing_key:
148
184
  specification_version: 4
149
185
  summary: Client gem for the MobilizeAmerica API
150
186
  test_files: []
data/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.6
4
- cache: bundler
5
- before_install:
6
- - gem install bundler
7
- script:
8
- - bundle exec rspec
9
- - bundle exec rubocop