mobilize-america-client 0.3.5 → 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: 8a0362285775791640e9e587d2ea5875981615bf134364f5438d2ce878472eb8
4
- data.tar.gz: 1497262d8a8bacde3d68082e4766b883b677480960fe33744994a87853ceb2cd
3
+ metadata.gz: 9a8aa2a6520cae7a352ffabce99976284b1348b63f16cdc29d9933fb7b5b0881
4
+ data.tar.gz: d5a2a05390fc6f003042d345a16a2bf903cce4e130347207581f2b7ae5178863
5
5
  SHA512:
6
- metadata.gz: d455bb7eda9dddf648794b53f48cdc4ccf7630492b0cc4709c17844c8d4978471df75e57743e91c320fedff7621132997030e2e7d48874c0550a2bc8b8c9a698
7
- data.tar.gz: e7f5a5ef755ab7b485e9ac8a89a97fb5ea663a507fef97ed5a3b3f62d5c5a25259f5eb77286b5472be0aca2517ba225aef626b335e95c40f726d98b20c946daa
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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MobilizeAmericaClient::Client
2
2
 
3
- [![Build Status](https://travis-ci.org/controlshift/mobilize_america_client.svg?branch=master)](https://travis-ci.org/controlshift/mobilize_america_client)
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
4
 
5
5
  A minimalist API client for the [MobilizeAmerica API](https://github.com/mobilizeamerica/api):
6
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.5
1
+ 0.3.6
@@ -2,6 +2,7 @@ require 'faraday'
2
2
  require 'mobilize_america_client/client/events'
3
3
  require 'mobilize_america_client/client/organizations'
4
4
  require 'mobilize_america_client/request'
5
+ require 'mobilize_america_client/errors'
5
6
 
6
7
  module MobilizeAmericaClient
7
8
  class Client
@@ -0,0 +1,4 @@
1
+ module MobilizeAmericaClient
2
+ class NotFoundError < StandardError
3
+ end
4
+ end
@@ -28,6 +28,10 @@ module MobilizeAmericaClient
28
28
  req.body = ::JSON.generate(body) unless body.empty?
29
29
  end
30
30
 
31
+ if response.status == 404
32
+ raise MobilizeAmericaClient::NotFoundError
33
+ end
34
+
31
35
  JSON.parse(response.body)
32
36
  end
33
37
  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.5 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.5"
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-10-14"
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",
@@ -37,6 +39,7 @@ Gem::Specification.new do |s|
37
39
  "lib/mobilize_america_client/client.rb",
38
40
  "lib/mobilize_america_client/client/events.rb",
39
41
  "lib/mobilize_america_client/client/organizations.rb",
42
+ "lib/mobilize_america_client/errors.rb",
40
43
  "lib/mobilize_america_client/request.rb",
41
44
  "mobilize-america-client.gemspec",
42
45
  "spec/client/client_spec.rb",
@@ -47,7 +50,7 @@ Gem::Specification.new do |s|
47
50
  ]
48
51
  s.homepage = "http://github.com/controlshift/mobilize_america_client".freeze
49
52
  s.licenses = ["MIT".freeze]
50
- s.rubygems_version = "3.0.8".freeze
53
+ s.rubygems_version = "3.0.9".freeze
51
54
  s.summary = "Client gem for the MobilizeAmerica API".freeze
52
55
 
53
56
  if s.respond_to? :specification_version then
@@ -12,6 +12,12 @@ 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
23
  expect(subject.organization_events(organization_id: org_id)).to eq(response)
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.5
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-10-14 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
@@ -122,7 +122,7 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
- description:
125
+ description:
126
126
  email: grey@controlshiftlabs.com
127
127
  executables:
128
128
  - console
@@ -133,9 +133,11 @@ extra_rdoc_files:
133
133
  - LICENSE.txt
134
134
  - README.md
135
135
  files:
136
+ - ".github/workflows/ci.yml"
136
137
  - ".rspec"
137
138
  - ".rubocop.yml"
138
- - ".travis.yml"
139
+ - ".ruby-gemset"
140
+ - ".ruby-version"
139
141
  - CODE_OF_CONDUCT.md
140
142
  - Gemfile
141
143
  - LICENSE
@@ -150,6 +152,7 @@ files:
150
152
  - lib/mobilize_america_client/client.rb
151
153
  - lib/mobilize_america_client/client/events.rb
152
154
  - lib/mobilize_america_client/client/organizations.rb
155
+ - lib/mobilize_america_client/errors.rb
153
156
  - lib/mobilize_america_client/request.rb
154
157
  - mobilize-america-client.gemspec
155
158
  - spec/client/client_spec.rb
@@ -161,7 +164,7 @@ homepage: http://github.com/controlshift/mobilize_america_client
161
164
  licenses:
162
165
  - MIT
163
166
  metadata: {}
164
- post_install_message:
167
+ post_install_message:
165
168
  rdoc_options: []
166
169
  require_paths:
167
170
  - lib
@@ -176,8 +179,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
179
  - !ruby/object:Gem::Version
177
180
  version: '0'
178
181
  requirements: []
179
- rubygems_version: 3.0.8
180
- signing_key:
182
+ rubygems_version: 3.1.6
183
+ signing_key:
181
184
  specification_version: 4
182
185
  summary: Client gem for the MobilizeAmerica API
183
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