pco_api 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +29 -25
 - data/lib/pco/api/errors.rb +1 -1
 - data/lib/pco/api/version.rb +1 -1
 - data/spec/pco/api/endpoint_spec.rb +26 -22
 - metadata +18 -15
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: fdf363aaf74caadf35c535566554358fbabe8a86
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b1222c3d2349a5617827b3256e63f53ac908d938
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f2d8c40236d7c1cc27c3e51858aa42586fdfbc779143707da8293d960d2618b107ed8cd1a44a7d4be01b6b8cd929c48504ddd8f731e61d627879c783123c242a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 0d75528107787fb437955582c5492aa57d7585ddbec65ebc40f2e1435a20b4e01d908fce67a8d7235f4c41780f0dd619b83e1fd11dd8daa3244d9e0ed3f65fad
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,6 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # pco_api
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
            [](https://circleci.com/gh/planningcenter/pco_api_ruby/tree/master)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            `pco_api` is a Rubygem that provides a simple wrapper around our RESTful JSON API at https://api.planningcenteronline.com.
         
     | 
| 
       4 
6 
     | 
    
         | 
| 
       5 
7 
     | 
    
         
             
            ## Installation
         
     | 
| 
       6 
8 
     | 
    
         | 
| 
         @@ -22,22 +24,22 @@ gem install pco_api 
     | 
|
| 
       22 
24 
     | 
    
         
             
            2. Chain path elements together as method calls.
         
     | 
| 
       23 
25 
     | 
    
         | 
| 
       24 
26 
     | 
    
         
             
                ```ruby
         
     | 
| 
       25 
     | 
    
         
            -
                api.people. 
     | 
| 
       26 
     | 
    
         
            -
                # /people/ 
     | 
| 
      
 27 
     | 
    
         
            +
                api.people.v2.households
         
     | 
| 
      
 28 
     | 
    
         
            +
                # /people/v2/households
         
     | 
| 
       27 
29 
     | 
    
         
             
                ```
         
     | 
| 
       28 
30 
     | 
    
         | 
| 
       29 
31 
     | 
    
         
             
            3. For IDs, treat the object like a hash (use square brackets).
         
     | 
| 
       30 
32 
     | 
    
         | 
| 
       31 
33 
     | 
    
         
             
                ```ruby
         
     | 
| 
       32 
     | 
    
         
            -
                api.people. 
     | 
| 
       33 
     | 
    
         
            -
                # /people/ 
     | 
| 
      
 34 
     | 
    
         
            +
                api.people.v2.households[1]
         
     | 
| 
      
 35 
     | 
    
         
            +
                # /people/v2/households/1
         
     | 
| 
       34 
36 
     | 
    
         
             
                ```
         
     | 
| 
       35 
37 
     | 
    
         | 
| 
       36 
38 
     | 
    
         
             
            4. To execute the request, use `get`, `post`, `patch`, or `delete`, optionally passing arguments.
         
     | 
| 
       37 
39 
     | 
    
         | 
| 
       38 
40 
     | 
    
         
             
                ```ruby
         
     | 
| 
       39 
     | 
    
         
            -
                api.people. 
     | 
| 
       40 
     | 
    
         
            -
                # GET /people/ 
     | 
| 
      
 41 
     | 
    
         
            +
                api.people.v2.households.get(order: 'name')
         
     | 
| 
      
 42 
     | 
    
         
            +
                # GET /people/v2/households?order=name
         
     | 
| 
       41 
43 
     | 
    
         
             
                ```
         
     | 
| 
       42 
44 
     | 
    
         | 
| 
       43 
45 
     | 
    
         
             
            ## Example
         
     | 
| 
         @@ -45,8 +47,8 @@ gem install pco_api 
     | 
|
| 
       45 
47 
     | 
    
         
             
            ```ruby
         
     | 
| 
       46 
48 
     | 
    
         
             
            require 'pco_api'
         
     | 
| 
       47 
49 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
            api = PCO::API.new( 
     | 
| 
       49 
     | 
    
         
            -
            api.people. 
     | 
| 
      
 50 
     | 
    
         
            +
            api = PCO::API.new(basic_auth_token: 'token', basic_auth_secret: 'secret')
         
     | 
| 
      
 51 
     | 
    
         
            +
            api.people.v2.people.get(order: 'last_name')
         
     | 
| 
       50 
52 
     | 
    
         
             
            ```
         
     | 
| 
       51 
53 
     | 
    
         | 
| 
       52 
54 
     | 
    
         
             
            ...which returns something like:
         
     | 
| 
         @@ -54,8 +56,8 @@ api.people.v1.people.get(order: 'last_name') 
     | 
|
| 
       54 
56 
     | 
    
         
             
            ```ruby
         
     | 
| 
       55 
57 
     | 
    
         
             
            {
         
     | 
| 
       56 
58 
     | 
    
         
             
              "links" => {
         
     | 
| 
       57 
     | 
    
         
            -
                "self" => "https://api.planningcenteronline.com/people/ 
     | 
| 
       58 
     | 
    
         
            -
                "next" => "https://api.planningcenteronline.com/people/ 
     | 
| 
      
 59 
     | 
    
         
            +
                "self" => "https://api.planningcenteronline.com/people/v2/people?order=last_name",
         
     | 
| 
      
 60 
     | 
    
         
            +
                "next" => "https://api.planningcenteronline.com/people/v2/people?offset=25&order=last_name"
         
     | 
| 
       59 
61 
     | 
    
         
             
              },
         
     | 
| 
       60 
62 
     | 
    
         
             
              "data"=> [
         
     | 
| 
       61 
63 
     | 
    
         
             
                {
         
     | 
| 
         @@ -78,7 +80,7 @@ api.people.v1.people.get(order: 'last_name') 
     | 
|
| 
       78 
80 
     | 
    
         
             
                  "updated_at" => "2015-04-10T18:59:51Z",
         
     | 
| 
       79 
81 
     | 
    
         
             
                  "avatar" => nil,
         
     | 
| 
       80 
82 
     | 
    
         
             
                  "links" => {
         
     | 
| 
       81 
     | 
    
         
            -
                    "self" => "https://api.planningcenteronline.com/people/ 
     | 
| 
      
 83 
     | 
    
         
            +
                    "self" => "https://api.planningcenteronline.com/people/v2/people/271"
         
     | 
| 
       82 
84 
     | 
    
         
             
                  }
         
     | 
| 
       83 
85 
     | 
    
         
             
                },
         
     | 
| 
       84 
86 
     | 
    
         
             
                # ...
         
     | 
| 
         @@ -146,11 +148,11 @@ api.people.v1.people.get(order: 'last_name') 
     | 
|
| 
       146 
148 
     | 
    
         | 
| 
       147 
149 
     | 
    
         
             
            ```ruby
         
     | 
| 
       148 
150 
     | 
    
         
             
            # collection
         
     | 
| 
       149 
     | 
    
         
            -
            api.people. 
     | 
| 
      
 151 
     | 
    
         
            +
            api.people.v2.people.get(order: 'last_name')
         
     | 
| 
       150 
152 
     | 
    
         
             
            # => { data: array_of_resources }
         
     | 
| 
       151 
153 
     | 
    
         | 
| 
       152 
154 
     | 
    
         
             
            # single resource
         
     | 
| 
       153 
     | 
    
         
            -
            api.people. 
     | 
| 
      
 155 
     | 
    
         
            +
            api.people.v2.people[1].get
         
     | 
| 
       154 
156 
     | 
    
         
             
            # => { data: resource_hash }
         
     | 
| 
       155 
157 
     | 
    
         
             
            ```
         
     | 
| 
       156 
158 
     | 
    
         | 
| 
         @@ -160,7 +162,7 @@ api.people.v1.people[1].get 
     | 
|
| 
       160 
162 
     | 
    
         
             
            a `{ data: { ... } }` hash.
         
     | 
| 
       161 
163 
     | 
    
         | 
| 
       162 
164 
     | 
    
         
             
            ```ruby
         
     | 
| 
       163 
     | 
    
         
            -
            api.people. 
     | 
| 
      
 165 
     | 
    
         
            +
            api.people.v2.people.post(data: { type: 'Person', attributes: { first_name: 'Tim', last_name: 'Morgan' } })
         
     | 
| 
       164 
166 
     | 
    
         
             
            # => { data: resource_hash }
         
     | 
| 
       165 
167 
     | 
    
         
             
            ```
         
     | 
| 
       166 
168 
     | 
    
         | 
| 
         @@ -170,7 +172,7 @@ api.people.v1.people.post(data: { first_name: 'Tim', last_name: 'Morgan' }) 
     | 
|
| 
       170 
172 
     | 
    
         
             
            a `{ data: { ... } }` hash.
         
     | 
| 
       171 
173 
     | 
    
         | 
| 
       172 
174 
     | 
    
         
             
            ```ruby
         
     | 
| 
       173 
     | 
    
         
            -
            api.people. 
     | 
| 
      
 175 
     | 
    
         
            +
            api.people.v2.people[1].patch(data: { type: 'Person', id: 1, attributes: { first_name: 'Tim', last_name: 'Morgan' } })
         
     | 
| 
       174 
176 
     | 
    
         
             
            # => { data: resource_hash }
         
     | 
| 
       175 
177 
     | 
    
         
             
            ```
         
     | 
| 
       176 
178 
     | 
    
         | 
| 
         @@ -179,13 +181,13 @@ api.people.v1.people[1].patch(data: { first_name: 'Tim', last_name: 'Morgan' }) 
     | 
|
| 
       179 
181 
     | 
    
         
             
            `delete()` sends a DELETE request to delete an existing resource. This method returns `true` if the delete was successful.
         
     | 
| 
       180 
182 
     | 
    
         | 
| 
       181 
183 
     | 
    
         
             
            ```ruby
         
     | 
| 
       182 
     | 
    
         
            -
            api.people. 
     | 
| 
      
 184 
     | 
    
         
            +
            api.people.v2.people[1].delete
         
     | 
| 
       183 
185 
     | 
    
         
             
            # => true
         
     | 
| 
       184 
186 
     | 
    
         
             
            ```
         
     | 
| 
       185 
187 
     | 
    
         | 
| 
       186 
188 
     | 
    
         
             
            ## Errors
         
     | 
| 
       187 
189 
     | 
    
         | 
| 
       188 
     | 
    
         
            -
            The following errors may be raised,  
     | 
| 
      
 190 
     | 
    
         
            +
            The following errors may be raised by the library, depending on the API response status code.
         
     | 
| 
       189 
191 
     | 
    
         | 
| 
       190 
192 
     | 
    
         
             
            | HTTP Status Codes   | Error Class                                                               |
         
     | 
| 
       191 
193 
     | 
    
         
             
            | ------------------- | ------------------------------------------------------------------------- |
         
     | 
| 
         @@ -199,15 +201,17 @@ The following errors may be raised, which you should rescue in most circumstance 
     | 
|
| 
       199 
201 
     | 
    
         
             
            | 500                 | `PCO::API::Errors::InternalServerError` < `PCO::API::Errors::ServerError` |
         
     | 
| 
       200 
202 
     | 
    
         
             
            | other 5xx errors    | `PCO::API::Errors::ServerError`                                           |
         
     | 
| 
       201 
203 
     | 
    
         | 
| 
       202 
     | 
    
         
            -
            The exception  
     | 
| 
      
 204 
     | 
    
         
            +
            The exception object has the following methods:
         
     | 
| 
      
 205 
     | 
    
         
            +
             
     | 
| 
      
 206 
     | 
    
         
            +
            | Method  | Content                                 |
         
     | 
| 
      
 207 
     | 
    
         
            +
            | ------- | --------------------------------------- |
         
     | 
| 
      
 208 
     | 
    
         
            +
            | status  | HTTP status code returned by the server |
         
     | 
| 
      
 209 
     | 
    
         
            +
            | message | the message returned by the API         |
         
     | 
| 
       203 
210 
     | 
    
         | 
| 
       204 
     | 
    
         
            -
             
     | 
| 
       205 
     | 
    
         
            -
            | ------- | ----------------------------------------------- |
         
     | 
| 
       206 
     | 
    
         
            -
            | status  | HTTP status code returned by the server         |
         
     | 
| 
       207 
     | 
    
         
            -
            | message | the body of the response returned by the server |
         
     | 
| 
      
 211 
     | 
    
         
            +
            The `message` should be a simple string given by the API, e.g. "Resource Not Found".
         
     | 
| 
       208 
212 
     | 
    
         | 
| 
       209 
     | 
    
         
            -
             
     | 
| 
       210 
     | 
    
         
            -
             
     | 
| 
      
 213 
     | 
    
         
            +
            Alternatively, you may rescue `PCO::API::Errors::BaseError` and branch your code based on
         
     | 
| 
      
 214 
     | 
    
         
            +
            the status code returned by calling `error.status`.
         
     | 
| 
       211 
215 
     | 
    
         | 
| 
       212 
216 
     | 
    
         
             
            ## Copyright & License
         
     | 
| 
       213 
217 
     | 
    
         | 
    
        data/lib/pco/api/errors.rb
    CHANGED
    
    
    
        data/lib/pco/api/version.rb
    CHANGED
    
    
| 
         @@ -2,35 +2,35 @@ require_relative '../../spec_helper' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require 'json'
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            describe PCO::API::Endpoint do
         
     | 
| 
       5 
     | 
    
         
            -
              let(:base) { described_class.new( 
     | 
| 
      
 5 
     | 
    
         
            +
              let(:base) { described_class.new(basic_auth_token: 'token', basic_auth_secret: 'secret') }
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
              subject { base }
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
              describe '#method_missing' do
         
     | 
| 
       10 
10 
     | 
    
         
             
                before do
         
     | 
| 
       11 
     | 
    
         
            -
                  @result = subject.people. 
     | 
| 
      
 11 
     | 
    
         
            +
                  @result = subject.people.v2
         
     | 
| 
       12 
12 
     | 
    
         
             
                end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
                it 'returns a wrapper object with updated url' do
         
     | 
| 
       15 
15 
     | 
    
         
             
                  expect(@result).to be_a(described_class)
         
     | 
| 
       16 
     | 
    
         
            -
                  expect(@result.url).to match(%r{/people/ 
     | 
| 
      
 16 
     | 
    
         
            +
                  expect(@result.url).to match(%r{/people/v2$})
         
     | 
| 
       17 
17 
     | 
    
         
             
                end
         
     | 
| 
       18 
18 
     | 
    
         
             
              end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
              describe '#[]' do
         
     | 
| 
       21 
21 
     | 
    
         
             
                before do
         
     | 
| 
       22 
     | 
    
         
            -
                  @result = subject.people. 
     | 
| 
      
 22 
     | 
    
         
            +
                  @result = subject.people.v2.people[1]
         
     | 
| 
       23 
23 
     | 
    
         
             
                end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
                it 'returns a wrapper object with updated url' do
         
     | 
| 
       26 
26 
     | 
    
         
             
                  expect(@result).to be_a(described_class)
         
     | 
| 
       27 
     | 
    
         
            -
                  expect(@result.url).to match(%r{/people/ 
     | 
| 
      
 27 
     | 
    
         
            +
                  expect(@result.url).to match(%r{/people/v2/people/1$})
         
     | 
| 
       28 
28 
     | 
    
         
             
                end
         
     | 
| 
       29 
29 
     | 
    
         
             
              end
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
31 
     | 
    
         
             
              describe '#get' do
         
     | 
| 
       32 
32 
     | 
    
         
             
                context 'given a good URL' do
         
     | 
| 
       33 
     | 
    
         
            -
                  subject { base.people. 
     | 
| 
      
 33 
     | 
    
         
            +
                  subject { base.people.v2 }
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
                  let(:result) do
         
     | 
| 
       36 
36 
     | 
    
         
             
                    {
         
     | 
| 
         @@ -42,7 +42,7 @@ describe PCO::API::Endpoint do 
     | 
|
| 
       42 
42 
     | 
    
         
             
                  end
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
                  before do
         
     | 
| 
       45 
     | 
    
         
            -
                    stub_request(:get, 'https://api.planningcenteronline.com/people/ 
     | 
| 
      
 45 
     | 
    
         
            +
                    stub_request(:get, 'https://api.planningcenteronline.com/people/v2')
         
     | 
| 
       46 
46 
     | 
    
         
             
                      .to_return(status: 200, body: { data: result }.to_json, headers: { 'Content-Type' => 'application/vnd.api+json' })
         
     | 
| 
       47 
47 
     | 
    
         
             
                    @result = subject.get
         
     | 
| 
       48 
48 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -54,7 +54,7 @@ describe PCO::API::Endpoint do 
     | 
|
| 
       54 
54 
     | 
    
         
             
                end
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
56 
     | 
    
         
             
                context 'given a non-existent URL' do
         
     | 
| 
       57 
     | 
    
         
            -
                  subject { base.people. 
     | 
| 
      
 57 
     | 
    
         
            +
                  subject { base.people.v2.non_existent }
         
     | 
| 
       58 
58 
     | 
    
         | 
| 
       59 
59 
     | 
    
         
             
                  let(:result) do
         
     | 
| 
       60 
60 
     | 
    
         
             
                    {
         
     | 
| 
         @@ -64,19 +64,23 @@ describe PCO::API::Endpoint do 
     | 
|
| 
       64 
64 
     | 
    
         
             
                  end
         
     | 
| 
       65 
65 
     | 
    
         | 
| 
       66 
66 
     | 
    
         
             
                  before do
         
     | 
| 
       67 
     | 
    
         
            -
                    stub_request(:get, 'https://api.planningcenteronline.com/people/ 
     | 
| 
      
 67 
     | 
    
         
            +
                    stub_request(:get, 'https://api.planningcenteronline.com/people/v2/non_existent')
         
     | 
| 
       68 
68 
     | 
    
         
             
                      .to_return(status: 404, body: result.to_json, headers: { 'Content-Type' => 'application/vnd.api+json' })
         
     | 
| 
       69 
69 
     | 
    
         
             
                  end
         
     | 
| 
       70 
70 
     | 
    
         | 
| 
       71 
71 
     | 
    
         
             
                  it 'raises a NotFound error' do
         
     | 
| 
       72 
     | 
    
         
            -
                     
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
      
 72 
     | 
    
         
            +
                    error = begin
         
     | 
| 
      
 73 
     | 
    
         
            +
                              subject.get
         
     | 
| 
      
 74 
     | 
    
         
            +
                            rescue PCO::API::Errors::NotFound => e
         
     | 
| 
      
 75 
     | 
    
         
            +
                              e
         
     | 
| 
      
 76 
     | 
    
         
            +
                            end
         
     | 
| 
      
 77 
     | 
    
         
            +
                    expect(error.status).to eq(404)
         
     | 
| 
      
 78 
     | 
    
         
            +
                    expect(error.message).to eq('Resource Not Found')
         
     | 
| 
       75 
79 
     | 
    
         
             
                  end
         
     | 
| 
       76 
80 
     | 
    
         
             
                end
         
     | 
| 
       77 
81 
     | 
    
         | 
| 
       78 
82 
     | 
    
         
             
                context 'given a client error' do
         
     | 
| 
       79 
     | 
    
         
            -
                  subject { base.people. 
     | 
| 
      
 83 
     | 
    
         
            +
                  subject { base.people.v2.error }
         
     | 
| 
       80 
84 
     | 
    
         | 
| 
       81 
85 
     | 
    
         
             
                  let(:result) do
         
     | 
| 
       82 
86 
     | 
    
         
             
                    {
         
     | 
| 
         @@ -86,7 +90,7 @@ describe PCO::API::Endpoint do 
     | 
|
| 
       86 
90 
     | 
    
         
             
                  end
         
     | 
| 
       87 
91 
     | 
    
         | 
| 
       88 
92 
     | 
    
         
             
                  before do
         
     | 
| 
       89 
     | 
    
         
            -
                    stub_request(:get, 'https://api.planningcenteronline.com/people/ 
     | 
| 
      
 93 
     | 
    
         
            +
                    stub_request(:get, 'https://api.planningcenteronline.com/people/v2/error')
         
     | 
| 
       90 
94 
     | 
    
         
             
                      .to_return(status: 400, body: result.to_json, headers: { 'Content-Type' => 'application/vnd.api+json' })
         
     | 
| 
       91 
95 
     | 
    
         
             
                  end
         
     | 
| 
       92 
96 
     | 
    
         | 
| 
         @@ -98,7 +102,7 @@ describe PCO::API::Endpoint do 
     | 
|
| 
       98 
102 
     | 
    
         
             
                end
         
     | 
| 
       99 
103 
     | 
    
         | 
| 
       100 
104 
     | 
    
         
             
                context 'given a server error' do
         
     | 
| 
       101 
     | 
    
         
            -
                  subject { base.people. 
     | 
| 
      
 105 
     | 
    
         
            +
                  subject { base.people.v2.error }
         
     | 
| 
       102 
106 
     | 
    
         | 
| 
       103 
107 
     | 
    
         
             
                  let(:result) do
         
     | 
| 
       104 
108 
     | 
    
         
             
                    {
         
     | 
| 
         @@ -108,7 +112,7 @@ describe PCO::API::Endpoint do 
     | 
|
| 
       108 
112 
     | 
    
         
             
                  end
         
     | 
| 
       109 
113 
     | 
    
         | 
| 
       110 
114 
     | 
    
         
             
                  before do
         
     | 
| 
       111 
     | 
    
         
            -
                    stub_request(:get, 'https://api.planningcenteronline.com/people/ 
     | 
| 
      
 115 
     | 
    
         
            +
                    stub_request(:get, 'https://api.planningcenteronline.com/people/v2/error')
         
     | 
| 
       112 
116 
     | 
    
         
             
                      .to_return(status: 500, body: result.to_json, headers: { 'Content-Type' => 'application/vnd.api+json' })
         
     | 
| 
       113 
117 
     | 
    
         
             
                  end
         
     | 
| 
       114 
118 
     | 
    
         | 
| 
         @@ -121,7 +125,7 @@ describe PCO::API::Endpoint do 
     | 
|
| 
       121 
125 
     | 
    
         
             
              end
         
     | 
| 
       122 
126 
     | 
    
         | 
| 
       123 
127 
     | 
    
         
             
              describe '#post' do
         
     | 
| 
       124 
     | 
    
         
            -
                subject { base.people. 
     | 
| 
      
 128 
     | 
    
         
            +
                subject { base.people.v2.people }
         
     | 
| 
       125 
129 
     | 
    
         | 
| 
       126 
130 
     | 
    
         
             
                let(:resource) do
         
     | 
| 
       127 
131 
     | 
    
         
             
                  {
         
     | 
| 
         @@ -141,7 +145,7 @@ describe PCO::API::Endpoint do 
     | 
|
| 
       141 
145 
     | 
    
         
             
                end
         
     | 
| 
       142 
146 
     | 
    
         | 
| 
       143 
147 
     | 
    
         
             
                before do
         
     | 
| 
       144 
     | 
    
         
            -
                  stub_request(:post, 'https://api.planningcenteronline.com/people/ 
     | 
| 
      
 148 
     | 
    
         
            +
                  stub_request(:post, 'https://api.planningcenteronline.com/people/v2/people')
         
     | 
| 
       145 
149 
     | 
    
         
             
                    .to_return(status: 201, body: { data: result }.to_json, headers: { 'Content-Type' => 'application/vnd.api+json' })
         
     | 
| 
       146 
150 
     | 
    
         
             
                  @result = subject.post(data: resource)
         
     | 
| 
       147 
151 
     | 
    
         
             
                end
         
     | 
| 
         @@ -153,7 +157,7 @@ describe PCO::API::Endpoint do 
     | 
|
| 
       153 
157 
     | 
    
         
             
              end
         
     | 
| 
       154 
158 
     | 
    
         | 
| 
       155 
159 
     | 
    
         
             
              describe '#patch' do
         
     | 
| 
       156 
     | 
    
         
            -
                subject { base.people. 
     | 
| 
      
 160 
     | 
    
         
            +
                subject { base.people.v2.people[1] }
         
     | 
| 
       157 
161 
     | 
    
         | 
| 
       158 
162 
     | 
    
         
             
                let(:resource) do
         
     | 
| 
       159 
163 
     | 
    
         
             
                  {
         
     | 
| 
         @@ -173,7 +177,7 @@ describe PCO::API::Endpoint do 
     | 
|
| 
       173 
177 
     | 
    
         
             
                end
         
     | 
| 
       174 
178 
     | 
    
         | 
| 
       175 
179 
     | 
    
         
             
                before do
         
     | 
| 
       176 
     | 
    
         
            -
                  stub_request(:patch, 'https://api.planningcenteronline.com/people/ 
     | 
| 
      
 180 
     | 
    
         
            +
                  stub_request(:patch, 'https://api.planningcenteronline.com/people/v2/people/1')
         
     | 
| 
       177 
181 
     | 
    
         
             
                    .to_return(status: 200, body: { data: result }.to_json, headers: { 'Content-Type' => 'application/vnd.api+json' })
         
     | 
| 
       178 
182 
     | 
    
         
             
                  @result = subject.patch(data: resource)
         
     | 
| 
       179 
183 
     | 
    
         
             
                end
         
     | 
| 
         @@ -185,10 +189,10 @@ describe PCO::API::Endpoint do 
     | 
|
| 
       185 
189 
     | 
    
         
             
              end
         
     | 
| 
       186 
190 
     | 
    
         | 
| 
       187 
191 
     | 
    
         
             
              describe '#delete' do
         
     | 
| 
       188 
     | 
    
         
            -
                subject { base.people. 
     | 
| 
      
 192 
     | 
    
         
            +
                subject { base.people.v2.people[1] }
         
     | 
| 
       189 
193 
     | 
    
         | 
| 
       190 
194 
     | 
    
         
             
                before do
         
     | 
| 
       191 
     | 
    
         
            -
                  stub_request(:delete, 'https://api.planningcenteronline.com/people/ 
     | 
| 
      
 195 
     | 
    
         
            +
                  stub_request(:delete, 'https://api.planningcenteronline.com/people/v2/people/1')
         
     | 
| 
       192 
196 
     | 
    
         
             
                    .to_return(status: 204, body: '')
         
     | 
| 
       193 
197 
     | 
    
         
             
                  @result = subject.delete
         
     | 
| 
       194 
198 
     | 
    
         
             
                end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: pco_api
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Planning Center Online
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015-06- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-06-06 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: faraday
         
     | 
| 
         @@ -42,14 +42,14 @@ dependencies: 
     | 
|
| 
       42 
42 
     | 
    
         
             
              name: excon
         
     | 
| 
       43 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       44 
44 
     | 
    
         
             
                requirements:
         
     | 
| 
       45 
     | 
    
         
            -
                - - " 
     | 
| 
      
 45 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       46 
46 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       47 
47 
     | 
    
         
             
                    version: 0.30.0
         
     | 
| 
       48 
48 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       49 
49 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       50 
50 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       51 
51 
     | 
    
         
             
                requirements:
         
     | 
| 
       52 
     | 
    
         
            -
                - - " 
     | 
| 
      
 52 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       53 
53 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       54 
54 
     | 
    
         
             
                    version: 0.30.0
         
     | 
| 
       55 
55 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
         @@ -58,44 +58,46 @@ dependencies: 
     | 
|
| 
       58 
58 
     | 
    
         
             
                requirements:
         
     | 
| 
       59 
59 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       60 
60 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       61 
     | 
    
         
            -
                    version: 3.2 
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '3.2'
         
     | 
| 
       62 
62 
     | 
    
         
             
              type: :development
         
     | 
| 
       63 
63 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       64 
64 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       65 
65 
     | 
    
         
             
                requirements:
         
     | 
| 
       66 
66 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       67 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       68 
     | 
    
         
            -
                    version: 3.2 
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '3.2'
         
     | 
| 
       69 
69 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       70 
70 
     | 
    
         
             
              name: webmock
         
     | 
| 
       71 
71 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       72 
72 
     | 
    
         
             
                requirements:
         
     | 
| 
       73 
73 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       74 
74 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       75 
     | 
    
         
            -
                    version: 1.21 
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '1.21'
         
     | 
| 
       76 
76 
     | 
    
         
             
              type: :development
         
     | 
| 
       77 
77 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       78 
78 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       79 
79 
     | 
    
         
             
                requirements:
         
     | 
| 
       80 
80 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       81 
81 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       82 
     | 
    
         
            -
                    version: 1.21 
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '1.21'
         
     | 
| 
       83 
83 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       84 
84 
     | 
    
         
             
              name: pry
         
     | 
| 
       85 
85 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       86 
86 
     | 
    
         
             
                requirements:
         
     | 
| 
       87 
87 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       88 
88 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       89 
     | 
    
         
            -
                    version: 0.10 
     | 
| 
      
 89 
     | 
    
         
            +
                    version: '0.10'
         
     | 
| 
       90 
90 
     | 
    
         
             
              type: :development
         
     | 
| 
       91 
91 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       92 
92 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       93 
93 
     | 
    
         
             
                requirements:
         
     | 
| 
       94 
94 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       95 
95 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       96 
     | 
    
         
            -
                    version: 0.10 
     | 
| 
       97 
     | 
    
         
            -
            description:  
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
      
 96 
     | 
    
         
            +
                    version: '0.10'
         
     | 
| 
      
 97 
     | 
    
         
            +
            description: pco_api is a gem for working with the RESTful JSON API at api.planningcenteronline.com
         
     | 
| 
      
 98 
     | 
    
         
            +
              using HTTP basic auth or OAuth 2.0. This library can talk to any endpoint the API
         
     | 
| 
      
 99 
     | 
    
         
            +
              provides, since it is written to build endpoint URLs dynamically using method_missing.
         
     | 
| 
      
 100 
     | 
    
         
            +
            email: support@planningcenteronline.com
         
     | 
| 
       99 
101 
     | 
    
         
             
            executables: []
         
     | 
| 
       100 
102 
     | 
    
         
             
            extensions: []
         
     | 
| 
       101 
103 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
         @@ -109,7 +111,8 @@ files: 
     | 
|
| 
       109 
111 
     | 
    
         
             
            - spec/pco/api/endpoint_spec.rb
         
     | 
| 
       110 
112 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       111 
113 
     | 
    
         
             
            homepage: https://github.com/planningcenter/pco_api_ruby
         
     | 
| 
       112 
     | 
    
         
            -
            licenses: 
     | 
| 
      
 114 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 115 
     | 
    
         
            +
            - MIT
         
     | 
| 
       113 
116 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       114 
117 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       115 
118 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
         @@ -119,7 +122,7 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       119 
122 
     | 
    
         
             
              requirements:
         
     | 
| 
       120 
123 
     | 
    
         
             
              - - ">="
         
     | 
| 
       121 
124 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       122 
     | 
    
         
            -
                  version:  
     | 
| 
      
 125 
     | 
    
         
            +
                  version: 2.0.0
         
     | 
| 
       123 
126 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       124 
127 
     | 
    
         
             
              requirements:
         
     | 
| 
       125 
128 
     | 
    
         
             
              - - ">="
         
     | 
| 
         @@ -130,7 +133,7 @@ rubyforge_project: 
     | 
|
| 
       130 
133 
     | 
    
         
             
            rubygems_version: 2.4.6
         
     | 
| 
       131 
134 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       132 
135 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       133 
     | 
    
         
            -
            summary:  
     | 
| 
      
 136 
     | 
    
         
            +
            summary: API wrapper for api.planningcenteronline.com
         
     | 
| 
       134 
137 
     | 
    
         
             
            test_files:
         
     | 
| 
       135 
138 
     | 
    
         
             
            - spec/pco/api/endpoint_spec.rb
         
     | 
| 
       136 
139 
     | 
    
         
             
            - spec/spec_helper.rb
         
     |