salsa_labs 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: f959fc08bf03b183bc7192bfe57e88cd6000bea6
4
- data.tar.gz: a16c2bf7e35a05622c185d1e96c758db622ed42c
3
+ metadata.gz: c6aa1c387f617c8241ea0e4878760b16f4955a8c
4
+ data.tar.gz: c49c445e9583d13c91f70dc9ac7ad3200d7e5121
5
5
  SHA512:
6
- metadata.gz: d445949a492a7ab0ecb613973504c2be89720d823eb68ef358ba978040a8f8557a98a6694c410368d73526368f75ef86e266d29a091a70a679de73a91c62d9fa
7
- data.tar.gz: cc0c9eed3af1871df89eaee964b23ec54881cd6a7b5f36de37a4a16d20754a2f1c9164ba40243ad70e181a9e62895836029efc8042a2ea0ad414137d06d878f0
6
+ metadata.gz: 023bbd1ddfb01954cf6fdf5180ed632bdb7ab605f4215c3937c6097906cccb52de73cacec68446500379f3fcdfc79445de1635620c46835a53a2e996e603d72d
7
+ data.tar.gz: 397308d3463fc11f12bdd9f4b98f603575b07851588d96ca4b530983d73b569ee3027693b051d864fb7e5ea1ef265e0455693882cde8518acd040146616a8794
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  coverage
2
2
  *.gem
3
3
  tmp
4
- .idea
4
+ .idea
5
+ .*swp
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.3.3
data/.travis.yml CHANGED
@@ -3,4 +3,5 @@ rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
5
  - 2.1.0
6
+ - 2.1.1
6
7
  - jruby-19mode
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- salsa_labs (0.0.2.alpha)
5
- dotenv (~> 0.9)
4
+ salsa_labs (0.0.4)
5
+ dotenv
6
6
  faraday (~> 0.8)
7
7
  httparty (~> 0.12)
8
8
  nokogiri (~> 1.5)
@@ -11,55 +11,53 @@ GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
13
  addressable (2.3.5)
14
- celluloid (0.15.2)
15
- timers (~> 1.1.0)
16
- celluloid-io (0.15.0)
17
- celluloid (>= 0.15.0)
18
- nio4r (>= 0.5.0)
19
- coderay (1.1.0)
14
+ coderay (1.1.1)
20
15
  crack (0.4.1)
21
16
  safe_yaml (~> 0.9.0)
22
17
  diff-lcs (1.2.5)
23
18
  docile (1.1.1)
24
- dotenv (0.9.0)
25
- faraday (0.8.8)
26
- multipart-post (~> 1.2.0)
27
- ffi (1.9.3)
28
- formatador (0.2.4)
29
- guard (2.5.1)
19
+ dotenv (2.1.2)
20
+ faraday (0.11.0)
21
+ multipart-post (>= 1.2, < 3)
22
+ ffi (1.9.17)
23
+ formatador (0.2.5)
24
+ guard (2.14.0)
30
25
  formatador (>= 0.2.4)
31
- listen (~> 2.6)
26
+ listen (>= 2.7, < 4.0)
32
27
  lumberjack (~> 1.0)
28
+ nenv (~> 0.1)
29
+ notiffany (~> 0.0)
33
30
  pry (>= 0.9.12)
31
+ shellany (~> 0.0)
34
32
  thor (>= 0.18.1)
35
- guard-rspec (4.2.8)
33
+ guard-rspec (4.3.1)
36
34
  guard (~> 2.1)
37
35
  rspec (>= 2.14, < 4.0)
38
- httparty (0.12.0)
39
- json (~> 1.8)
36
+ httparty (0.14.0)
40
37
  multi_xml (>= 0.5.2)
41
- json (1.8.1)
42
- listen (2.7.0)
43
- celluloid (>= 0.15.2)
44
- celluloid-io (>= 0.15.0)
45
- rb-fsevent (>= 0.9.3)
46
- rb-inotify (>= 0.9)
47
- lumberjack (1.0.4)
38
+ listen (3.1.5)
39
+ rb-fsevent (~> 0.9, >= 0.9.4)
40
+ rb-inotify (~> 0.9, >= 0.9.7)
41
+ ruby_dep (~> 1.2)
42
+ lumberjack (1.0.11)
48
43
  method_source (0.8.2)
49
- mini_portile (0.5.2)
44
+ mini_portile2 (2.1.0)
50
45
  multi_json (1.8.2)
51
- multi_xml (0.5.5)
52
- multipart-post (1.2.0)
53
- nio4r (1.0.0)
54
- nokogiri (1.6.1)
55
- mini_portile (~> 0.5.0)
56
- pry (0.9.12.6)
57
- coderay (~> 1.0)
58
- method_source (~> 0.8)
46
+ multi_xml (0.6.0)
47
+ multipart-post (2.0.0)
48
+ nenv (0.3.0)
49
+ nokogiri (1.7.0.1)
50
+ mini_portile2 (~> 2.1.0)
51
+ notiffany (0.1.1)
52
+ nenv (~> 0.1)
53
+ shellany (~> 0.0)
54
+ pry (0.10.4)
55
+ coderay (~> 1.1.0)
56
+ method_source (~> 0.8.1)
59
57
  slop (~> 3.4)
60
58
  rake (10.1.1)
61
- rb-fsevent (0.9.4)
62
- rb-inotify (0.9.3)
59
+ rb-fsevent (0.9.8)
60
+ rb-inotify (0.9.7)
63
61
  ffi (>= 0.5.0)
64
62
  rspec (2.14.1)
65
63
  rspec-core (~> 2.14.0)
@@ -69,15 +67,16 @@ GEM
69
67
  rspec-expectations (2.14.4)
70
68
  diff-lcs (>= 1.1.3, < 2.0)
71
69
  rspec-mocks (2.14.4)
70
+ ruby_dep (1.5.0)
72
71
  safe_yaml (0.9.7)
72
+ shellany (0.0.1)
73
73
  simplecov (0.8.2)
74
74
  docile (~> 1.1.0)
75
75
  multi_json
76
76
  simplecov-html (~> 0.8.0)
77
77
  simplecov-html (0.8.0)
78
- slop (3.4.7)
79
- thor (0.18.1)
80
- timers (1.1.0)
78
+ slop (3.6.0)
79
+ thor (0.19.4)
81
80
  vcr (2.8.0)
82
81
  webmock (1.16.1)
83
82
  addressable (>= 2.2.7)
@@ -95,3 +94,6 @@ DEPENDENCIES
95
94
  simplecov (~> 0.8)
96
95
  vcr (~> 2.8)
97
96
  webmock (~> 1.16)
97
+
98
+ BUNDLED WITH
99
+ 1.14.2
@@ -8,6 +8,10 @@ module SalsaLabs
8
8
  (attributes['action_key'] || 0).to_i
9
9
  end
10
10
 
11
+ def chapter_key
12
+ attributes['chapter_key'].to_i if attributes['chapter_key']
13
+ end
14
+
11
15
  def description
12
16
  attributes['description']
13
17
  end
@@ -10,6 +10,7 @@ module SalsaLabs
10
10
  def initialize(credentials = {})
11
11
  @email = credentials[:email] || ENV['SALSA_LABS_API_EMAIL']
12
12
  @password = credentials[:password] || ENV['SALSA_LABS_API_PASSWORD']
13
+ @host = credentials[:host] || 'hq-salsa.wiredforchange.com'
13
14
 
14
15
  @authenticated = false
15
16
  end
@@ -37,7 +38,8 @@ module SalsaLabs
37
38
 
38
39
  attr_reader :authenticated,
39
40
  :email,
40
- :password
41
+ :password,
42
+ :host
41
43
 
42
44
  def authenticate!
43
45
  perform_get_request(
@@ -52,7 +54,7 @@ module SalsaLabs
52
54
 
53
55
  def connection
54
56
  @connection ||= Faraday.
55
- new(url: 'https://hq-salsa.wiredforchange.com') do |faraday|
57
+ new(url: "https://#{host}") do |faraday|
56
58
 
57
59
  faraday.use Faraday::Request::UrlEncoded
58
60
  faraday.adapter Faraday.default_adapter
@@ -1,3 +1,3 @@
1
1
  module SalsaLabs
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
data/salsa_labs.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.require_paths = ['lib']
17
17
  gem.licenses = ['LICENSE']
18
18
 
19
- gem.add_runtime_dependency 'dotenv', '~> 0.9'
19
+ gem.add_runtime_dependency 'dotenv'
20
20
  gem.add_runtime_dependency 'faraday', '~> 0.8'
21
21
  gem.add_runtime_dependency 'httparty', '~> 0.12'
22
22
  gem.add_runtime_dependency 'nokogiri', '~> 1.5'
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0"?>
2
+
3
+ <data organization_KEY="6120">
4
+ <message>Successful Login</message>
5
+ </data>
@@ -7,6 +7,7 @@ describe SalsaLabs::Action do
7
7
  'action_key' => '1234',
8
8
  'description' => 'Lengthy Description',
9
9
  'organization_key' => '90210',
10
+ 'chapter_key' => '234',
10
11
  'reference_name' => 'A Good Reference',
11
12
  'title' => 'A Distinguished Title'
12
13
  }
@@ -20,6 +21,12 @@ describe SalsaLabs::Action do
20
21
  end
21
22
  end
22
23
 
24
+ describe "#chapter_key" do
25
+ it "returns the chapter_key attribute as an integer" do
26
+ expect(action.chapter_key).to eq(234)
27
+ end
28
+ end
29
+
23
30
  describe "#attributes" do
24
31
  it "returns the attributes hash passed in to initialize" do
25
32
  expect(action.attributes).to eq(attributes)
@@ -2,7 +2,6 @@ require 'spec_helper'
2
2
  require 'vcr'
3
3
 
4
4
  describe SalsaLabs::ApiClient do
5
-
6
5
  let(:api_client) do
7
6
  SalsaLabs::ApiClient.new({
8
7
  email: 'allison@example.com', password: 'password'
@@ -12,7 +11,7 @@ describe SalsaLabs::ApiClient do
12
11
  describe "#authenticate" do
13
12
  it "stores the cookie from Salsa Labs" do
14
13
  VCR.use_cassette 'successful_authentication',
15
- match_requests_on: [:path] do
14
+ match_requests_on: [:host, :path] do
16
15
 
17
16
  api_client.authenticate
18
17
 
@@ -28,7 +27,7 @@ describe SalsaLabs::ApiClient do
28
27
  context "with proper credentials" do
29
28
  it "sets authenticated to be true" do
30
29
  VCR.use_cassette 'successful_authentication',
31
- match_requests_on: [:path] do
30
+ match_requests_on: [:host, :path] do
32
31
 
33
32
  api_client.authenticate
34
33
 
@@ -41,7 +40,7 @@ describe SalsaLabs::ApiClient do
41
40
  context "with improper credentials" do
42
41
  it "raises an exception" do
43
42
  VCR.use_cassette 'unsuccessful_authentication',
44
- match_requests_on: [:path] do
43
+ match_requests_on: [:host, :path] do
45
44
 
46
45
  expect{
47
46
  api_client.authenticate
@@ -62,7 +61,7 @@ describe SalsaLabs::ApiClient do
62
61
  describe "#fetch" do
63
62
  it "returns the body of the response from Salsa Labs for that API call" do
64
63
  VCR.use_cassette 'get_objects/action',
65
- match_requests_on: [:path] do
64
+ match_requests_on: [:host, :path] do
66
65
 
67
66
  data = api_client.fetch('/api/getObjects.sjs', object: 'Action')
68
67
 
@@ -72,6 +71,18 @@ describe SalsaLabs::ApiClient do
72
71
  end
73
72
  end
74
73
 
74
+ it "can be configured with Salsa API host" do
75
+ url = "https://example.com/api/authenticate.sjs?email=allison@example.com&password=password"
76
+ successful_login = File.read('spec/fixtures/successful_login.xml')
77
+ stub_request(:get, url).to_return(body: successful_login)
78
+
79
+ SalsaLabs::ApiClient.new(email: 'allison@example.com',
80
+ password: 'password',
81
+ host: 'example.com').authenticate
82
+
83
+ WebMock.should have_requested(:get, url)
84
+ end
85
+
75
86
  def salsa_get_objects_for_action_xml_response
76
87
  File.read('spec/fixtures/getObjects.sjs_action.xml').gsub(/\n|\s{2,}/, '')
77
88
  end
data/spec/spec_helper.rb CHANGED
@@ -5,7 +5,7 @@ require 'salsa_labs'
5
5
 
6
6
  require 'rspec/autorun'
7
7
  require 'vcr'
8
- require 'webmock'
8
+ require 'webmock/rspec'
9
9
 
10
10
  WebMock.disable_net_connect!
11
11
 
@@ -17,4 +17,5 @@ VCR.configure do |c|
17
17
  c.cassette_library_dir = 'spec/vcr_cassettes'
18
18
  c.hook_into :faraday
19
19
  c.hook_into :webmock
20
+ c.allow_http_connections_when_no_cassette = true
20
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salsa_labs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoff Harcourt
@@ -9,160 +9,160 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-15 00:00:00.000000000 Z
12
+ date: 2017-01-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dotenv
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '0.9'
20
+ version: '0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '0.9'
27
+ version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: faraday
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0.8'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0.8'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: httparty
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0.12'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0.12'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: nokogiri
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ~>
60
+ - - "~>"
61
61
  - !ruby/object:Gem::Version
62
62
  version: '1.5'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ~>
67
+ - - "~>"
68
68
  - !ruby/object:Gem::Version
69
69
  version: '1.5'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: guard
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: guard-rspec
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '>='
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '>='
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rake
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - ~>
102
+ - - "~>"
103
103
  - !ruby/object:Gem::Version
104
104
  version: 10.1.1
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ~>
109
+ - - "~>"
110
110
  - !ruby/object:Gem::Version
111
111
  version: 10.1.1
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: rspec
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - ~>
116
+ - - "~>"
117
117
  - !ruby/object:Gem::Version
118
118
  version: '2.14'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - ~>
123
+ - - "~>"
124
124
  - !ruby/object:Gem::Version
125
125
  version: '2.14'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: simplecov
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - ~>
130
+ - - "~>"
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0.8'
133
133
  type: :development
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - ~>
137
+ - - "~>"
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0.8'
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: vcr
142
142
  requirement: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - ~>
144
+ - - "~>"
145
145
  - !ruby/object:Gem::Version
146
146
  version: '2.8'
147
147
  type: :development
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
- - - ~>
151
+ - - "~>"
152
152
  - !ruby/object:Gem::Version
153
153
  version: '2.8'
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: webmock
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
- - - ~>
158
+ - - "~>"
159
159
  - !ruby/object:Gem::Version
160
160
  version: '1.16'
161
161
  type: :development
162
162
  prerelease: false
163
163
  version_requirements: !ruby/object:Gem::Requirement
164
164
  requirements:
165
- - - ~>
165
+ - - "~>"
166
166
  - !ruby/object:Gem::Version
167
167
  version: '1.16'
168
168
  description: A Ruby binding for the Salsa Labs (http://salsalabs.com) API.
@@ -172,11 +172,11 @@ executables: []
172
172
  extensions: []
173
173
  extra_rdoc_files: []
174
174
  files:
175
- - .gitignore
176
- - .rspec
177
- - .ruby-gemset
178
- - .ruby-version
179
- - .travis.yml
175
+ - ".gitignore"
176
+ - ".rspec"
177
+ - ".ruby-gemset"
178
+ - ".ruby-version"
179
+ - ".travis.yml"
180
180
  - Gemfile
181
181
  - Gemfile.lock
182
182
  - Guardfile
@@ -195,6 +195,7 @@ files:
195
195
  - spec/fixtures/getObjects.sjs_action.xml
196
196
  - spec/fixtures/getObjects.sjs_supporter.xml
197
197
  - spec/fixtures/getObjects.sjs_supporter_actions.xml
198
+ - spec/fixtures/successful_login.xml
198
199
  - spec/salsa_labs/action_spec.rb
199
200
  - spec/salsa_labs/api_client_spec.rb
200
201
  - spec/salsa_labs/objects_fetcher_spec.rb
@@ -215,17 +216,17 @@ require_paths:
215
216
  - lib
216
217
  required_ruby_version: !ruby/object:Gem::Requirement
217
218
  requirements:
218
- - - '>='
219
+ - - ">="
219
220
  - !ruby/object:Gem::Version
220
221
  version: '0'
221
222
  required_rubygems_version: !ruby/object:Gem::Requirement
222
223
  requirements:
223
- - - '>='
224
+ - - ">="
224
225
  - !ruby/object:Gem::Version
225
226
  version: '0'
226
227
  requirements: []
227
228
  rubyforge_project:
228
- rubygems_version: 2.0.14
229
+ rubygems_version: 2.6.8
229
230
  signing_key:
230
231
  specification_version: 4
231
232
  summary: Salsa Labs' API contains information about supporters, donations, and actions.
@@ -234,6 +235,7 @@ test_files:
234
235
  - spec/fixtures/getObjects.sjs_action.xml
235
236
  - spec/fixtures/getObjects.sjs_supporter.xml
236
237
  - spec/fixtures/getObjects.sjs_supporter_actions.xml
238
+ - spec/fixtures/successful_login.xml
237
239
  - spec/salsa_labs/action_spec.rb
238
240
  - spec/salsa_labs/api_client_spec.rb
239
241
  - spec/salsa_labs/objects_fetcher_spec.rb