confrater 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a657e0b6f40bcefaa6e75445c188f3d58219958248dc01ce7aed33db8524524e
4
- data.tar.gz: 01cdb26c479da1ad3c89f5b8f4f8a64a466e8810760884cd43b41084dbee3ed2
3
+ metadata.gz: 11c11662359a01424e663dc257825b942519850a1fed3f986d287619a29e6e32
4
+ data.tar.gz: 6f72480270c5fcf657270012c0f1ff4fccb9f2e912c6fde846b4443158784b24
5
5
  SHA512:
6
- metadata.gz: 106feff91b10bc8a688178cfb4bd0a8837602b073b4d2014c0155689270bf57f1218e31443220d51b1306f04db2a55d7c2fed02e9abfd7dda40711f932992090
7
- data.tar.gz: d86f4dce95ec98cc07e9224c6ad7b29d4b0b990af89f50d498e976b9fb2133db1ea2da03812777a9780cc53ca484b6ab9e8d454f74367066e3b128854dd12f18
6
+ metadata.gz: 0ed430dd7da5cdb4f31d791c85c58fe549f3796030ed3d51dc78cf9f0dcd6a7492dfcad67f8b49f5bd0c7c2b5bb8653dab7337cfab0b5e6f473cfcf1c1eccd35
7
+ data.tar.gz: 372d637e427095a88fe47e1157d004a739f16db3646a2e77d9efb100e86303c0250ef8d08fa187fc47271df46302f5f7a9d04318d4b39ab891357420b0474e86
@@ -4,11 +4,11 @@ Confrere is an API wrapper for the [Confrere API](https://developer.confrere.com
4
4
 
5
5
  ## Important Notes
6
6
 
7
- Confrere returns a `Confrere::Response` instead of the response body directly. `Confrere::Response` exposes the parsed response `body` and `headers`.
7
+ Confrere returns a `Confrater::Response` instead of the response body directly. `Confrater::Response` exposes the parsed response `body` and `headers`.
8
8
 
9
9
  ## Installation
10
10
 
11
- $ gem install confrere
11
+ $ gem install confrater
12
12
 
13
13
  ## Authentication
14
14
 
@@ -16,10 +16,10 @@ The Confrere API authenticates using username and password which you can retriev
16
16
 
17
17
  ## Usage
18
18
 
19
- First, create a *one-time use instance* of `Confrere::Request`:
19
+ First, create a *one-time use instance* of `Confrater::Request`:
20
20
 
21
21
  ```ruby
22
- confrere = Confrere::Request.new(username: "your client id", password: "your secret")
22
+ confrere = Confrater::Request.new(username: "your client id", password: "your secret")
23
23
  ```
24
24
 
25
25
  ***Note*** Only reuse instances of Confrere after terminating a call with a verb, which makes a request. Requests are light weight objects that update an internal path based on your call chain. When you terminate a call chain with a verb, a request instance makes a request and resets the path.
@@ -39,7 +39,7 @@ are specified inline and a `CRUD` (`create`, `retrieve`, `update`, or `delete`)
39
39
  You can specify `headers`, `params`, and `body` when calling a `CRUD` method. For example:
40
40
 
41
41
  ```ruby
42
- confrere.customers.retrieve(headers: {"SomeHeader": "SomeHeaderValue"}, params: {"query_param": "query_param_value"})
42
+ confrere.users.retrieve(headers: {"SomeHeader": "SomeHeaderValue"}, params: {"query_param": "query_param_value"})
43
43
  ```
44
44
 
45
45
  Of course, `body` is only supported on `create` and `update` calls. Those map to HTTP `POST` and `PUT` verbs respectively.
@@ -47,12 +47,12 @@ Of course, `body` is only supported on `create` and `update` calls. Those map to
47
47
  You can set `username`, `password`, `api_endpoint`, `timeout`, `open_timeout`, `faraday_adapter`, `proxy`, `symbolize_keys`, `logger`, and `debug` globally:
48
48
 
49
49
  ```ruby
50
- Confrere::Request.username = "your_client_id"
51
- Confrere::Request.password = "your_secret"
52
- Confrere::Request.timeout = 15
53
- Confrere::Request.open_timeout = 15
54
- Confrere::Request.symbolize_keys = true
55
- Confrere::Request.debug = false
50
+ Confrater::Request.username = "your_client_id"
51
+ Confrater::Request.password = "your_secret"
52
+ Confrater::Request.timeout = 15
53
+ Confrater::Request.open_timeout = 15
54
+ Confrater::Request.symbolize_keys = true
55
+ Confrater::Request.debug = false
56
56
  ```
57
57
 
58
58
  For example, you could set the values above in an `initializer` file in your `Rails` app (e.g. your\_app/config/initializers/confrere.rb).
@@ -60,7 +60,7 @@ For example, you could set the values above in an `initializer` file in your `Ra
60
60
  Assuming you've set the credentials on Confrere, you can conveniently make API calls on the class itself:
61
61
 
62
62
  ```ruby
63
- Confrere::Request.customers.retrieve
63
+ Confrater::Request.users.retrieve
64
64
  ```
65
65
 
66
66
  ***Note*** Substitute an underscore if a resource name contains a hyphen.
@@ -68,7 +68,7 @@ Confrere::Request.customers.retrieve
68
68
  Pass `symbolize_keys: true` to use symbols (instead of strings) as hash keys in API responses.
69
69
 
70
70
  ```ruby
71
- confrere = Confrere::Request.new(username: "your_client_id", password: "your_secret", symbolize_keys: true)
71
+ confrere = Confrater::Request.new(username: "your_client_id", password: "your_secret", symbolize_keys: true)
72
72
  ```
73
73
 
74
74
  Confrere's [API documentation](https://developer.confrere.com/reference) is a list of available endpoints.
@@ -78,7 +78,7 @@ Confrere's [API documentation](https://developer.confrere.com/reference) is a li
78
78
  Pass `debug: true` to enable debug logging to STDOUT.
79
79
 
80
80
  ```ruby
81
- confrere = Confrere::Request.new(username: "your_client_id", password: "your_secret", debug: true)
81
+ confrere = Confrater::Request.new(username: "your_client_id", password: "your_secret", debug: true)
82
82
  ```
83
83
 
84
84
  ### Custom logger
@@ -86,74 +86,50 @@ confrere = Confrere::Request.new(username: "your_client_id", password: "your_sec
86
86
  Ruby `Logger.new` is used by default, but it can be overrided using:
87
87
 
88
88
  ```ruby
89
- confrere = Confrere::Request.new(username: "your_client_id", password: "your_secret", debug: true, logger: MyLogger.new)
89
+ confrere = Confrater::Request.new(username: "your_client_id", password: "your_secret", debug: true, logger: MyLogger.new)
90
90
  ```
91
91
 
92
92
  Logger can be also set by globally:
93
93
 
94
94
  ```ruby
95
- Confrere::Request.logger = MyLogger.new
95
+ Confrater::Request.logger = MyLogger.new
96
96
  ```
97
97
 
98
98
  ## Examples
99
99
 
100
- ### Customers
100
+ ### Users
101
101
 
102
- Fetch all customers:
102
+ Fetch all users:
103
103
 
104
104
  ```ruby
105
- confrere.customers.retrieve
105
+ confrere.users.retrieve
106
106
  ```
107
107
 
108
- By default the Confrere API returns 50 results. To set the count to 50:
108
+ Retrieving a specific user looks like:
109
109
 
110
110
  ```ruby
111
- confrere.customers.retrieve(params: {"pagesize": "100"})
111
+ confrere.users(user_id).retrieve
112
112
  ```
113
113
 
114
- And to retrieve the next 50 customers:
114
+ ### Appointments
115
115
 
116
- ```ruby
117
- confrere.customers.retrieve(params: {"pagesize": "100", "page": "2"})
118
- ```
119
-
120
- Query using filters:
121
-
122
- ```ruby
123
- confrere.customers.retrieve(params: {"filter": "contains(Name, ‘MakePlans’)"})
124
- ```
125
-
126
- Retrieving a specific customer looks like:
127
-
128
- ```ruby
129
- confrere.customers(customer_id).retrieve
130
- ```
131
-
132
- Add a new customer:
133
-
134
- ```ruby
135
- confrere.customers.create(body: {"Name": "MakePlans AS"})
136
- ```
137
-
138
- ### Fields
139
-
140
- Only retrieve ids and names for fetched customers:
116
+ Add a new appointment:
141
117
 
142
118
  ```ruby
143
- confrere.customers.retrieve(params: {"select": "Id, Name"})
119
+ confrere.appointmets.create(body: {"name": "MakePlans"})
144
120
  ```
145
121
 
146
122
  ### Error handling
147
123
 
148
124
  Confrere raises an error when the API returns an error.
149
125
 
150
- `Confrere::ConfrereError` has the following attributes: `title`, `detail`, `body`, `raw_body`, `status_code`. Some or all of these may not be
126
+ `Confrater::ConfrereError` has the following attributes: `title`, `detail`, `body`, `raw_body`, `status_code`. Some or all of these may not be
151
127
  available depending on the nature of the error. For example:
152
128
 
153
129
  ```ruby
154
130
  begin
155
- confrere.customers.create(body: body)
156
- rescue Confrere::ConfrereError => e
131
+ confrere.users.create(body: body)
132
+ rescue Confrater::ConfrereError => e
157
133
  puts "Houston, we have a problem: #{e.message} - #{e.raw_body}"
158
134
  end
159
135
  ```
@@ -169,13 +145,13 @@ confrere.proxy = 'http://your_proxy.com:80'
169
145
  You can set a different [Faraday adapter](https://github.com/lostisland/faraday) during initialization:
170
146
 
171
147
  ```ruby
172
- confrere = Confrere::Request.new(username: "your_client_id", password: "your_secret", faraday_adapter: :net_http)
148
+ confrere = Confrater::Request.new(username: "your_client_id", password: "your_secret", faraday_adapter: :net_http)
173
149
  ```
174
150
 
175
151
  #### Initialization
176
152
 
177
153
  ```ruby
178
- confrere = Confrere::Request.new(username: "your_client_id", password: "your_secret")
154
+ confrere = Confrater::Request.new(username: "your_client_id", password: "your_secret")
179
155
  ```
180
156
 
181
157
  ## Thanks
@@ -1,10 +1,10 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
- require 'confrere/version'
3
+ require 'confrater/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "confrater"
7
- s.version = Confrere::VERSION
7
+ s.version = Confrater::VERSION
8
8
  s.authors = ["Espen Antonsen", "Amro Mousa"]
9
9
  s.homepage = "http://github.com/espen/confrere"
10
10
 
@@ -0,0 +1,13 @@
1
+ require 'faraday'
2
+ require 'multi_json'
3
+ require 'cgi'
4
+ require 'logger'
5
+
6
+ require 'confrater/confrere_error'
7
+ require 'confrater/api_error'
8
+ require 'confrater/request'
9
+ require 'confrater/api_request'
10
+ require 'confrater/response'
11
+
12
+ module Confrater
13
+ end
@@ -1,4 +1,4 @@
1
- module Confrere
1
+ module Confrater
2
2
  class APIError < StandardError
3
3
  attr_reader :title, :detail, :body, :raw_body, :status_code
4
4
 
@@ -1,4 +1,4 @@
1
- module Confrere
1
+ module Confrater
2
2
  class APIRequest
3
3
 
4
4
  def initialize(builder: nil)
@@ -186,7 +186,7 @@ module Confrere
186
186
  username = self.username
187
187
  password = self.password
188
188
  unless username && password
189
- raise Confrere::ConfrereError, "You must set credentials prior to making a call"
189
+ raise Confrater::ConfrereError, "You must set credentials prior to making a call"
190
190
  end
191
191
  end
192
192
 
@@ -1,3 +1,3 @@
1
- module Confrere
1
+ module Confrater
2
2
  class ConfrereError < StandardError; end
3
3
  end
@@ -1,4 +1,4 @@
1
- module Confrere
1
+ module Confrater
2
2
  class Request
3
3
  attr_accessor :username, :password, :api_environment, :api_endpoint, :timeout, :open_timeout, :proxy, :faraday_adapter, :symbolize_keys, :debug, :logger
4
4
 
@@ -1,4 +1,4 @@
1
- module Confrere
1
+ module Confrater
2
2
  class Response
3
3
  attr_accessor :body, :headers
4
4
 
@@ -0,0 +1,3 @@
1
+ module Confrater
2
+ VERSION = "0.0.2"
3
+ end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Confrere::APIError do
3
+ describe Confrater::APIError do
4
4
  let(:message) { 'Foo' }
5
5
  let(:params) do
6
6
  {
@@ -13,7 +13,7 @@ describe Confrere::APIError do
13
13
  end
14
14
 
15
15
  before do
16
- @confrere = Confrere::APIError.new(message, params)
16
+ @confrere = Confrater::APIError.new(message, params)
17
17
  end
18
18
 
19
19
  it "adds the error params to the error message" do
@@ -1,40 +1,40 @@
1
1
  require 'spec_helper'
2
2
  require 'webmock/rspec'
3
3
 
4
- describe Confrere::APIRequest do
4
+ describe Confrater::APIRequest do
5
5
  let(:username) { "42" }
6
6
  let(:password) { "hemmelig" }
7
7
 
8
8
  before do
9
- @confrere = Confrere::Request.new(username: username, password: password)
9
+ @confrere = Confrater::Request.new(username: username, password: password)
10
10
  @api_root = "https://api.confrere.com/v1"
11
11
  end
12
12
 
13
- it "surfaces client request exceptions as a Confrere::APIError" do
13
+ it "surfaces client request exceptions as a Confrater::APIError" do
14
14
  exception = Faraday::Error::ClientError.new("the server responded with status 503")
15
15
  stub_request(:get, "#{@api_root}/users").with(basic_auth: [username, password]).to_raise(exception)
16
- expect { @confrere.users.retrieve }.to raise_error(Confrere::APIError)
16
+ expect { @confrere.users.retrieve }.to raise_error(Confrater::APIError)
17
17
  end
18
18
 
19
- it "surfaces an unparseable client request exception as a Confrere::APIError" do
19
+ it "surfaces an unparseable client request exception as a Confrater::APIError" do
20
20
  exception = Faraday::Error::ClientError.new(
21
21
  "the server responded with status 503")
22
22
  stub_request(:get, "#{@api_root}/users").with(basic_auth: [username, password]).to_raise(exception)
23
- expect { @confrere.users.retrieve }.to raise_error(Confrere::APIError)
23
+ expect { @confrere.users.retrieve }.to raise_error(Confrater::APIError)
24
24
  end
25
25
 
26
- it "surfaces an unparseable response body as a Confrere::APIError" do
26
+ it "surfaces an unparseable response body as a Confrater::APIError" do
27
27
  response_values = {:status => 503, :headers => {}, :body => '[foo]'}
28
28
  exception = Faraday::Error::ClientError.new("the server responded with status 503", response_values)
29
29
  stub_request(:get, "#{@api_root}/users").with(basic_auth: [username, password]).to_raise(exception)
30
- expect { @confrere.users.retrieve }.to raise_error(Confrere::APIError)
30
+ expect { @confrere.users.retrieve }.to raise_error(Confrater::APIError)
31
31
  end
32
32
 
33
33
  context "handle_error" do
34
34
  it "includes status and raw body even when json can't be parsed" do
35
35
  response_values = {:status => 503, :headers => {}, :body => 'A non JSON response'}
36
36
  exception = Faraday::Error::ClientError.new("the server responded with status 503", response_values)
37
- api_request = Confrere::APIRequest.new(builder: Confrere::Request)
37
+ api_request = Confrater::APIRequest.new(builder: Confrater::Request)
38
38
  begin
39
39
  api_request.send :handle_error, exception
40
40
  rescue => boom
@@ -47,7 +47,7 @@ describe Confrere::APIRequest do
47
47
  it "sets title and detail on the error params" do
48
48
  response_values = {:status => 422, :headers => {}, :body => '{"title": "foo", "detail": "bar"}'}
49
49
  exception = Faraday::Error::ClientError.new("the server responded with status 422", response_values)
50
- api_request = Confrere::APIRequest.new(builder: Confrere::Request.new(symbolize_keys: true))
50
+ api_request = Confrater::APIRequest.new(builder: Confrater::Request.new(symbolize_keys: true))
51
51
  begin
52
52
  api_request.send :handle_error, exception
53
53
  rescue => boom
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
  require 'cgi'
3
3
 
4
- describe Confrere do
4
+ describe Confrater do
5
5
  describe "attributes" do
6
6
  before do
7
- Confrere::APIRequest.send(:public, *Confrere::APIRequest.protected_instance_methods)
7
+ Confrater::APIRequest.send(:public, *Confrater::APIRequest.protected_instance_methods)
8
8
 
9
9
  @username = "42"
10
10
  @password = "hemmelig"
@@ -12,18 +12,18 @@ describe Confrere do
12
12
  end
13
13
 
14
14
  it "have no API by default" do
15
- @confrere = Confrere::Request.new
15
+ @confrere = Confrater::Request.new
16
16
  expect(@confrere.username).to be_nil
17
17
  end
18
18
 
19
19
  it "sets an API key in the constructor" do
20
- @confrere = Confrere::Request.new(username: @username, password: @password)
20
+ @confrere = Confrater::Request.new(username: @username, password: @password)
21
21
  expect(@confrere.username).to eq(@username)
22
22
  expect(@confrere.password).to eq(@password)
23
23
  end
24
24
 
25
25
  it "sets an API key via setter" do
26
- @confrere = Confrere::Request.new
26
+ @confrere = Confrater::Request.new
27
27
  @confrere.username = @username
28
28
  @confrere.password = @password
29
29
  expect(@confrere.username).to eq(@username)
@@ -31,102 +31,102 @@ describe Confrere do
31
31
  end
32
32
 
33
33
  it "sets timeout and get" do
34
- @confrere = Confrere::Request.new
34
+ @confrere = Confrater::Request.new
35
35
  timeout = 30
36
36
  @confrere.timeout = timeout
37
37
  expect(timeout).to eq(@confrere.timeout)
38
38
  end
39
39
 
40
40
  it "sets the open_timeout and get" do
41
- @confrere = Confrere::Request.new
41
+ @confrere = Confrater::Request.new
42
42
  open_timeout = 30
43
43
  @confrere.open_timeout = open_timeout
44
44
  expect(open_timeout).to eq(@confrere.open_timeout)
45
45
  end
46
46
 
47
47
  it "timeout properly passed to APIRequest" do
48
- @confrere = Confrere::Request.new
48
+ @confrere = Confrater::Request.new
49
49
  timeout = 30
50
50
  @confrere.timeout = timeout
51
- @request = Confrere::APIRequest.new(builder: @confrere)
51
+ @request = Confrater::APIRequest.new(builder: @confrere)
52
52
  expect(timeout).to eq(@request.timeout)
53
53
  end
54
54
 
55
55
  it "timeout properly based on open_timeout passed to APIRequest" do
56
- @confrere = Confrere::Request.new
56
+ @confrere = Confrater::Request.new
57
57
  open_timeout = 30
58
58
  @confrere.open_timeout = open_timeout
59
- @request = Confrere::APIRequest.new(builder: @confrere)
59
+ @request = Confrater::APIRequest.new(builder: @confrere)
60
60
  expect(open_timeout).to eq(@request.open_timeout)
61
61
  end
62
62
 
63
63
  it "has no Proxy url by default" do
64
- @confrere = Confrere::Request.new
64
+ @confrere = Confrater::Request.new
65
65
  expect(@confrere.proxy).to be_nil
66
66
  end
67
67
 
68
68
  it "sets an proxy url key from the 'CONFRERE_PROXY_URL' ENV variable" do
69
69
  ENV['CONFRERE_PROXY_URL'] = @proxy
70
- @confrere = Confrere::Request.new
70
+ @confrere = Confrater::Request.new
71
71
  expect(@confrere.proxy).to eq(@proxy)
72
72
  ENV.delete('CONFRERE_PROXY_URL')
73
73
  end
74
74
 
75
75
  it "sets an API key via setter" do
76
- @confrere = Confrere::Request.new
76
+ @confrere = Confrater::Request.new
77
77
  @confrere.proxy = @proxy
78
78
  expect(@confrere.proxy).to eq(@proxy)
79
79
  end
80
80
 
81
81
  it "sets an adapter in the constructor" do
82
82
  adapter = :em_synchrony
83
- @confrere = Confrere::Request.new(faraday_adapter: adapter)
83
+ @confrere = Confrater::Request.new(faraday_adapter: adapter)
84
84
  expect(@confrere.faraday_adapter).to eq(adapter)
85
85
  end
86
86
 
87
87
  it "symbolize_keys false by default" do
88
- @confrere = Confrere::Request.new
88
+ @confrere = Confrater::Request.new
89
89
  expect(@confrere.symbolize_keys).to be false
90
90
  end
91
91
 
92
92
  it "sets symbolize_keys in the constructor" do
93
- @confrere = Confrere::Request.new(symbolize_keys: true)
93
+ @confrere = Confrater::Request.new(symbolize_keys: true)
94
94
  expect(@confrere.symbolize_keys).to be true
95
95
  end
96
96
 
97
97
  it "sets symbolize_keys in the constructor" do
98
- @confrere = Confrere::Request.new(symbolize_keys: true)
98
+ @confrere = Confrater::Request.new(symbolize_keys: true)
99
99
  expect(@confrere.symbolize_keys).to be true
100
100
  end
101
101
 
102
102
  it "debug false by default" do
103
- @confrere = Confrere::Request.new
103
+ @confrere = Confrater::Request.new
104
104
  expect(@confrere.debug).to be false
105
105
  end
106
106
 
107
107
  it "sets debug in the constructor" do
108
- @confrere = Confrere::Request.new(debug: true)
108
+ @confrere = Confrater::Request.new(debug: true)
109
109
  expect(@confrere.debug).to be true
110
110
  end
111
111
 
112
112
  it "sets logger in constructor" do
113
113
  logger = double(:logger)
114
- @confrere = Confrere::Request.new(logger: logger)
114
+ @confrere = Confrater::Request.new(logger: logger)
115
115
  expect(@confrere.logger).to eq(logger)
116
116
  end
117
117
 
118
118
  it "is a Logger instance by default" do
119
- @confrere = Confrere::Request.new
119
+ @confrere = Confrater::Request.new
120
120
  expect(@confrere.logger).to be_a Logger
121
121
  end
122
122
 
123
123
  it "api_environment production by default" do
124
- @confrere = Confrere::Request.new
124
+ @confrere = Confrater::Request.new
125
125
  expect(@confrere.api_environment).to be :production
126
126
  end
127
127
 
128
128
  it "sets api_environment in the constructor" do
129
- @confrere = Confrere::Request.new(api_environment: :sandbox)
129
+ @confrere = Confrater::Request.new(api_environment: :sandbox)
130
130
  expect(@confrere.api_environment).to be :sandbox
131
131
  end
132
132
 
@@ -134,12 +134,12 @@ describe Confrere do
134
134
 
135
135
  describe "supports different environments" do
136
136
  before do
137
- Confrere::APIRequest.send(:public, *Confrere::APIRequest.protected_instance_methods)
137
+ Confrater::APIRequest.send(:public, *Confrater::APIRequest.protected_instance_methods)
138
138
  end
139
139
 
140
140
  it "has correct api url" do
141
- @confrere = Confrere::Request.new()
142
- @request = Confrere::APIRequest.new(builder: @confrere)
141
+ @confrere = Confrater::Request.new()
142
+ @request = Confrater::APIRequest.new(builder: @confrere)
143
143
  expect(@request.send(:base_api_url)).to eq("https://api.confrere.com/v1/")
144
144
  end
145
145
 
@@ -147,13 +147,13 @@ describe Confrere do
147
147
 
148
148
  describe "build api url" do
149
149
  before do
150
- Confrere::APIRequest.send(:public, *Confrere::APIRequest.protected_instance_methods)
150
+ Confrater::APIRequest.send(:public, *Confrater::APIRequest.protected_instance_methods)
151
151
 
152
- @confrere = Confrere::Request.new
152
+ @confrere = Confrater::Request.new
153
153
  end
154
154
 
155
155
  it "doesn't allow empty api username or password" do
156
- expect {@confrere.try.retrieve}.to raise_error(Confrere::ConfrereError)
156
+ expect {@confrere.try.retrieve}.to raise_error(Confrater::ConfrereError)
157
157
  end
158
158
 
159
159
  end
@@ -162,80 +162,80 @@ describe Confrere do
162
162
  let(:logger) { double(:logger) }
163
163
 
164
164
  before do
165
- Confrere::Request.username = "42"
166
- Confrere::Request.password = "hemmelig"
167
- Confrere::Request.timeout = 15
168
- Confrere::Request.api_environment = :sandbox
169
- Confrere::Request.api_endpoint = 'https://confrere.example.org/v1337/'
170
- Confrere::Request.logger = logger
171
- Confrere::Request.proxy = "http://1234.com"
172
- Confrere::Request.symbolize_keys = true
173
- Confrere::Request.faraday_adapter = :net_http
174
- Confrere::Request.debug = true
165
+ Confrater::Request.username = "42"
166
+ Confrater::Request.password = "hemmelig"
167
+ Confrater::Request.timeout = 15
168
+ Confrater::Request.api_environment = :sandbox
169
+ Confrater::Request.api_endpoint = 'https://confrere.example.org/v1337/'
170
+ Confrater::Request.logger = logger
171
+ Confrater::Request.proxy = "http://1234.com"
172
+ Confrater::Request.symbolize_keys = true
173
+ Confrater::Request.faraday_adapter = :net_http
174
+ Confrater::Request.debug = true
175
175
  end
176
176
 
177
177
  after do
178
- Confrere::Request.username = nil
179
- Confrere::Request.password = nil
180
- Confrere::Request.timeout = nil
181
- Confrere::Request.api_environment = nil
182
- Confrere::Request.api_endpoint = nil
183
- Confrere::Request.logger = nil
184
- Confrere::Request.proxy = nil
185
- Confrere::Request.symbolize_keys = nil
186
- Confrere::Request.faraday_adapter = nil
187
- Confrere::Request.debug = nil
178
+ Confrater::Request.username = nil
179
+ Confrater::Request.password = nil
180
+ Confrater::Request.timeout = nil
181
+ Confrater::Request.api_environment = nil
182
+ Confrater::Request.api_endpoint = nil
183
+ Confrater::Request.logger = nil
184
+ Confrater::Request.proxy = nil
185
+ Confrater::Request.symbolize_keys = nil
186
+ Confrater::Request.faraday_adapter = nil
187
+ Confrater::Request.debug = nil
188
188
  end
189
189
 
190
190
  it "set username on new instances" do
191
- expect(Confrere::Request.new.username).to eq(Confrere::Request.username)
191
+ expect(Confrater::Request.new.username).to eq(Confrater::Request.username)
192
192
  end
193
193
 
194
194
  it "set password on new instances" do
195
- expect(Confrere::Request.new.password).to eq(Confrere::Request.password)
195
+ expect(Confrater::Request.new.password).to eq(Confrater::Request.password)
196
196
  end
197
197
 
198
198
  it "set timeout on new instances" do
199
- expect(Confrere::Request.new.timeout).to eq(Confrere::Request.timeout)
199
+ expect(Confrater::Request.new.timeout).to eq(Confrater::Request.timeout)
200
200
  end
201
201
 
202
202
  it "set api_environment on new instances" do
203
- expect(Confrere::Request.api_environment).not_to be_nil
204
- expect(Confrere::Request.new.api_environment).to eq(Confrere::Request.api_environment)
203
+ expect(Confrater::Request.api_environment).not_to be_nil
204
+ expect(Confrater::Request.new.api_environment).to eq(Confrater::Request.api_environment)
205
205
  end
206
206
 
207
207
  it "set api_endpoint on new instances" do
208
- expect(Confrere::Request.api_endpoint).not_to be_nil
209
- expect(Confrere::Request.new.api_endpoint).to eq(Confrere::Request.api_endpoint)
208
+ expect(Confrater::Request.api_endpoint).not_to be_nil
209
+ expect(Confrater::Request.new.api_endpoint).to eq(Confrater::Request.api_endpoint)
210
210
  end
211
211
 
212
212
  it "set proxy on new instances" do
213
- expect(Confrere::Request.new.proxy).to eq(Confrere::Request.proxy)
213
+ expect(Confrater::Request.new.proxy).to eq(Confrater::Request.proxy)
214
214
  end
215
215
 
216
216
  it "set symbolize_keys on new instances" do
217
- expect(Confrere::Request.new.symbolize_keys).to eq(Confrere::Request.symbolize_keys)
217
+ expect(Confrater::Request.new.symbolize_keys).to eq(Confrater::Request.symbolize_keys)
218
218
  end
219
219
 
220
220
  it "set debug on new instances" do
221
- expect(Confrere::Request.new.debug).to eq(Confrere::Request.debug)
221
+ expect(Confrater::Request.new.debug).to eq(Confrater::Request.debug)
222
222
  end
223
223
 
224
224
  it "set faraday_adapter on new instances" do
225
- expect(Confrere::Request.new.faraday_adapter).to eq(Confrere::Request.faraday_adapter)
225
+ expect(Confrater::Request.new.faraday_adapter).to eq(Confrater::Request.faraday_adapter)
226
226
  end
227
227
 
228
228
  it "set logger on new instances" do
229
- expect(Confrere::Request.new.logger).to eq(logger)
229
+ expect(Confrater::Request.new.logger).to eq(logger)
230
230
  end
231
231
  end
232
232
 
233
233
  describe "missing methods" do
234
234
  it "respond to .method call on class" do
235
- expect(Confrere::Request.method(:customers)).to be_a(Method)
235
+ expect(Confrater::Request.method(:appointmets)).to be_a(Method)
236
236
  end
237
237
  it "respond to .method call on instance" do
238
- expect(Confrere::Request.new.method(:customers)).to be_a(Method)
238
+ expect(Confrater::Request.new.method(:appointmets)).to be_a(Method)
239
239
  end
240
240
  end
241
241
  end
@@ -5,7 +5,7 @@ Bundler.setup(:default, :development)
5
5
 
6
6
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
7
  $LOAD_PATH.unshift(File.dirname(__FILE__))
8
- require 'confrere'
8
+ require 'confrater'
9
9
 
10
10
  RSpec.configure do |config|
11
11
  config.color = true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confrater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Espen Antonsen
@@ -93,17 +93,17 @@ files:
93
93
  - LICENSE.txt
94
94
  - README.markdown
95
95
  - Rakefile
96
- - confrere.gemspec
97
- - lib/confrere.rb
98
- - lib/confrere/api_error.rb
99
- - lib/confrere/api_request.rb
100
- - lib/confrere/confrere_error.rb
101
- - lib/confrere/request.rb
102
- - lib/confrere/response.rb
103
- - lib/confrere/version.rb
104
- - spec/confrere/api_error_spec.rb
105
- - spec/confrere/api_request_spec.rb
106
- - spec/confrere/confrere_spec.rb
96
+ - confrater.gemspec
97
+ - lib/confrater.rb
98
+ - lib/confrater/api_error.rb
99
+ - lib/confrater/api_request.rb
100
+ - lib/confrater/confrere_error.rb
101
+ - lib/confrater/request.rb
102
+ - lib/confrater/response.rb
103
+ - lib/confrater/version.rb
104
+ - spec/confrater/api_error_spec.rb
105
+ - spec/confrater/api_request_spec.rb
106
+ - spec/confrater/confrater.rb
107
107
  - spec/spec_helper.rb
108
108
  homepage: http://github.com/espen/confrere
109
109
  licenses:
@@ -129,7 +129,7 @@ signing_key:
129
129
  specification_version: 4
130
130
  summary: A wrapper for Confrere API
131
131
  test_files:
132
- - spec/confrere/api_error_spec.rb
133
- - spec/confrere/api_request_spec.rb
134
- - spec/confrere/confrere_spec.rb
132
+ - spec/confrater/api_error_spec.rb
133
+ - spec/confrater/api_request_spec.rb
134
+ - spec/confrater/confrater.rb
135
135
  - spec/spec_helper.rb
@@ -1,13 +0,0 @@
1
- require 'faraday'
2
- require 'multi_json'
3
- require 'cgi'
4
- require 'logger'
5
-
6
- require 'confrere/confrere_error'
7
- require 'confrere/api_error'
8
- require 'confrere/request'
9
- require 'confrere/api_request'
10
- require 'confrere/response'
11
-
12
- module Confrere
13
- end
@@ -1,3 +0,0 @@
1
- module Confrere
2
- VERSION = "0.0.1"
3
- end