fulcrum 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZWY2MDkwMWM5ZWI3NjUxNzExMTQxNzRhYTNmMjg0OGJjNDdkNDhmNA==
5
+ data.tar.gz: !binary |-
6
+ YzU0ZWNhZmE4ODc1MmViYjVlMTI1NjVjM2M0Y2QxMDBjYTgxNWYyZg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NjA2NjdiM2JkNDViMGEzODQ5OWU1N2MzMzc3NmI0YzNhNDlhYzBhNDY4NDhm
10
+ N2RiNGM4NjM1ZjNkMjAxNzZmZjgwNDdiNWQ1ZDBmZTMzYTJjYzA2MDA2N2M3
11
+ ZTg2NmIwMTc0OTJjZjM1ZTdlNDZiNzhmNzAwNzU0OTFlYjIwNzE=
12
+ data.tar.gz: !binary |-
13
+ MTRkOTIwNzQwNDI5YjFiZTE4ZTc0YzkyZWU0ZWEyMThlMDRkNjRkYzA4YzUx
14
+ MzAwZTkyOGRiMmRlMjM2N2M3MDgzYjVlNDhjZjExMGIxYjJmYWZiNTZmMWYx
15
+ ZTU0MTNjYjE5MjBhODExNjliZmZlNTliNzRlYjc2NDFmYjhkMTU=
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm use ruby-1.9.3@fulcrum_api
1
+ rvm use ruby-1.9.3@fulcrum_api --create
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in fulcrum.gemspec
4
3
  gemspec
data/README.md CHANGED
@@ -4,122 +4,140 @@ Fulcrum API Gem
4
4
 
5
5
  ## Requirements
6
6
 
7
- ruby 1.9.x
8
- a [fulcrum user account](http://web.fulcrumapp.com)
7
+ * Ruby 1.9
8
+ * [Fulcrum user account](https://web.fulcrumapp.com)
9
9
 
10
10
  ## Installation
11
11
 
12
12
  Add this line to your application's Gemfile:
13
13
 
14
- gem 'fulcrum'
14
+ ```ruby
15
+ gem 'fulcrum'
16
+ ```
15
17
 
16
18
  And then execute:
17
19
 
18
- $ bundle
20
+ bundle
19
21
 
20
22
  Or install it yourself as:
21
23
 
22
- $ gem install fulcrum
24
+ gem install fulcrum
23
25
 
24
26
  ## Configuration
25
27
 
26
- Fulcrum::Api.configure do |config|
27
- config.uri = 'http://web.fulcrumapp.com/api/v2'
28
- config.key = 'your_api_key'
29
- end
28
+ ```ruby
29
+ Fulcrum::Api.configure do |config|
30
+ config.uri = 'https://api.fulcrumapp.com/api/v2'
31
+ config.key = 'your_api_key'
32
+ end
33
+ ```
30
34
 
31
35
  ## Projects
32
36
 
33
- Fulcrum::Project.all(opts)
34
- # opts = { 'page' => page_number,
35
- # 'updated_since' => date_time }
37
+ ```ruby
38
+ Fulcrum::Project.all(opts)
39
+ # opts = { 'page' => page_number,
40
+ # 'updated_since' => date_time }
41
+ ```
36
42
 
37
43
  ## Forms
38
44
 
39
- Fulcrum::Form.all(opts)
40
- # opts = { 'page' => page_number,
41
- # 'schema' => true_or_false }
45
+ ```ruby
46
+ Fulcrum::Form.all(opts)
47
+ # opts = { 'page' => page_number,
48
+ # 'schema' => true_or_false }
42
49
 
43
- Fulcrum::Form.find(id, opts)
44
- # opts = { 'include_foreign_elements' => true_or_false }
50
+ Fulcrum::Form.find(id, opts)
51
+ # opts = { 'include_foreign_elements' => true_or_false }
45
52
 
46
- Fulcrum::Form.create(form)
47
- # form = { 'form' => { ... } }
53
+ Fulcrum::Form.create(form)
54
+ # form = { 'form' => { ... } }
48
55
 
49
- Fulcrum::Form.update(id, form)
50
- # form = { 'form' => { ... } }
56
+ Fulcrum::Form.update(id, form)
57
+ # form = { 'form' => { ... } }
51
58
 
52
- Fulcrum::Form.delete(id)
59
+ Fulcrum::Form.delete(id)
60
+ ```
53
61
 
54
62
  ## Records
55
63
 
56
- Fulcrum::Record.all(opts)
57
- # opts = { 'page' => page_number,
58
- # 'form_id' => form_id,
59
- # 'bounding_box' => 'lat_bottom,lng_left,lat_top,lng_right',
60
- # 'updated_since' => date_since_epoch_in_seconds }
64
+ ```ruby
65
+ Fulcrum::Record.all(opts)
66
+ # opts = { 'page' => page_number,
67
+ # 'form_id' => form_id,
68
+ # 'bounding_box' => 'lat_bottom,lng_left,lat_top,lng_right',
69
+ # 'updated_since' => date_since_epoch_in_seconds }
61
70
 
62
- Fulcrum::Record.find(id)
63
- Fulcrum::Record.create(record)
64
- # record = { 'record' => { ... } }
71
+ Fulcrum::Record.find(id)
72
+ Fulcrum::Record.create(record)
73
+ # record = { 'record' => { ... } }
65
74
 
66
- Fulcrum::Record.update(id, record)
67
- # record = { 'record' => { ... } }
75
+ Fulcrum::Record.update(id, record)
76
+ # record = { 'record' => { ... } }
68
77
 
69
- Fulcrum::Record.delete(id)
78
+ Fulcrum::Record.delete(id)
79
+ ```
70
80
 
71
81
  ## Photos
72
82
 
73
- Fulcrum::Photo.find(access_key, opts)
74
- # opts = { 'format' => 'json|jpg' }, defaults to 'json'
83
+ ```ruby
84
+ Fulcrum::Photo.find(access_key, opts)
85
+ # opts = { 'format' => 'json|jpg' }, defaults to 'json'
75
86
 
76
- Fulcrum::Photo.thumbnail(access_key, opts)
77
- # opts = { 'format' => 'json|jpg' }, defaults to 'json'
87
+ Fulcrum::Photo.thumbnail(access_key, opts)
88
+ # opts = { 'format' => 'json|jpg' }, defaults to 'json'
78
89
 
79
- Fulcrum::Photo.create(photo, content_type, unique_id, label)
90
+ Fulcrum::Photo.create(photo, content_type, unique_id, label)
80
91
 
81
- Fulcrum::Photo.delete(access_key)
92
+ Fulcrum::Photo.delete(access_key)
93
+ ```
82
94
 
83
95
  ## Choice Lists
84
96
 
85
- Fulcrum::ChoiceList.all(opts)
86
- # opts = { 'page' => page_number }
97
+ ```ruby
98
+ Fulcrum::ChoiceList.all(opts)
99
+ # opts = { 'page' => page_number }
87
100
 
88
- Fulcrum::ChoiceList.find(id)
101
+ Fulcrum::ChoiceList.find(id)
89
102
 
90
- Fulcrum::ChoiceList.create(choice_list)
91
- # choice_list = { 'choice_list' => { ... } }
103
+ Fulcrum::ChoiceList.create(choice_list)
104
+ # choice_list = { 'choice_list' => { ... } }
92
105
 
93
- Fulcrum::ChoiceList.update(id, choice_list)
94
- # choice_list = { 'choice_list' => { ... } }
106
+ Fulcrum::ChoiceList.update(id, choice_list)
107
+ # choice_list = { 'choice_list' => { ... } }
95
108
 
96
- Fulcrum::ChoiceList.delete(id)
109
+ Fulcrum::ChoiceList.delete(id)
110
+ ```
97
111
 
98
112
  ## Classification Sets
99
113
 
100
- Fulcrum::ClassificationSet.all(opts)
101
- # opts = { 'page' => page_number }
114
+ ```ruby
115
+ Fulcrum::ClassificationSet.all(opts)
116
+ # opts = { 'page' => page_number }
102
117
 
103
- Fulcrum::ClassificationSet.find(id)
118
+ Fulcrum::ClassificationSet.find(id)
104
119
 
105
- Fulcrum::ClassificationSet.create(classification_set)
106
- # classification_set = { 'classification_set' => { ... } }
120
+ Fulcrum::ClassificationSet.create(classification_set)
121
+ # classification_set = { 'classification_set' => { ... } }
107
122
 
108
- Fulcrum::ClassificationSet.update(id, classification_set)
109
- # classification_set = { 'classification_set' => { ... } }
123
+ Fulcrum::ClassificationSet.update(id, classification_set)
124
+ # classification_set = { 'classification_set' => { ... } }
110
125
 
111
- Fulcrum::ClassificationSet.delete(id)
126
+ Fulcrum::ClassificationSet.delete(id)
127
+ ```
112
128
 
113
129
  ## Members
114
130
 
115
- Fulcrum::Member.all(opts)
116
- # opts = { 'page' => page_number }
131
+ ```ruby
132
+ Fulcrum::Member.all(opts)
133
+ # opts = { 'page' => page_number }
117
134
 
118
- Fulcrum::Member.find(id)
135
+ Fulcrum::Member.find(id)
136
+ ```
119
137
 
120
138
  ## Extra Reading
121
139
 
122
- [Fulcrum API docs](http://developer.fulcrumapp.com/api/fulcrum-api.html)
140
+ * [Fulcrum API documentation](http://fulcrumapp.com/developers/api/)
123
141
 
124
142
  ## Contributing
125
143
 
data/fulcrum.gemspec CHANGED
@@ -2,10 +2,10 @@
2
2
  require File.expand_path('../lib/fulcrum/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ["Chris Hall"]
6
- gem.email = ["chris@spatialnetworks.com"]
7
- gem.description = %q{Fulcrum API Gem}
8
- gem.summary = %q{Fulcrum API Gem}
5
+ gem.authors = ["Spatial Networks"]
6
+ gem.email = ["sniadmin@spatialnetworks.com"]
7
+ gem.description = %q{Fulcrum API}
8
+ gem.summary = %q{Fulcrum API}
9
9
  gem.homepage = "http://github.com/spatialnetworks/fulcrum-ruby"
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
21
21
  gem.add_development_dependency 'debugger'
22
22
 
23
23
  gem.add_dependency 'activesupport'
24
- gem.add_dependency 'faraday'
24
+ gem.add_dependency 'faraday', '~> 0.8.8'
25
25
  gem.add_dependency 'hashie'
26
26
  gem.add_dependency 'faraday_middleware'
27
27
  end
data/lib/fulcrum/api.rb CHANGED
@@ -90,6 +90,10 @@ module Fulcrum
90
90
  class Configuration
91
91
  attr_accessor :uri
92
92
  attr_accessor :key
93
+
94
+ def initialize
95
+ self.uri = 'https://api.fulcrumapp.com/api/v2'
96
+ end
93
97
  end
94
98
  end
95
99
  end
data/lib/fulcrum/form.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  module Fulcrum
2
2
  class Form < Api
3
-
4
3
  class << self
5
4
 
6
5
  def all(opts = {})
@@ -1,3 +1,3 @@
1
1
  module Fulcrum
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
data/spec/lib/api_spec.rb CHANGED
@@ -1,39 +1,42 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Fulcrum::Api do
4
- before(:all) do
5
- @uri = 'http://foo.bar/api/v2'
6
- @key = 'foobar'
4
+ let(:default_uri) { 'https://api.fulcrumapp.com/api/v2' }
5
+
6
+ let(:uri) { 'http://foo.bar/api/v2' }
7
+ let(:key) { 'foobar' }
8
+
9
+ it 'has a default uri' do
10
+ Fulcrum::Api.configuration.uri.should eq(default_uri)
11
+ end
12
+
13
+ it 'is configured' do
7
14
  Fulcrum::Api.configure do |config|
8
- config.uri = 'http://foo.bar/api/v2'
9
- config.key = 'foobar'
15
+ config.uri = uri
16
+ config.key = key
10
17
  end
11
- end
12
18
 
13
- it 'should be configured' do
14
- Fulcrum::Api.configuration.uri.should eq(@uri)
15
- Fulcrum::Api.configuration.key.should eq(@key)
19
+ Fulcrum::Api.configuration.uri.should eq(uri)
20
+ Fulcrum::Api.configuration.key.should eq(key)
16
21
  end
17
22
 
18
- it 'should get the key' do
23
+ it 'gets the key' do
19
24
  user = "foo@bar.com"
20
25
  pass = "foobar"
21
26
  stub_request(:get, /.*\/users.json/).to_return(:status => 200, :body => '{ "user": { "api_token": "foobar" }}')
22
27
  Fulcrum::Api.get_key(user, pass).should eq('foobar')
23
28
  end
24
29
 
25
- it 'parse_opts should return only expected opts' do
30
+ specify '#parse_opts returns only expected opts' do
26
31
  params = Fulcrum::Api.parse_opts([:foo], { foo: 'bar', bar: 'foo'})
27
- params.has_key?(:foo).should be(true)
28
- params[:foo].should eq('bar')
29
- params.has_key?(:bar).should be(false)
32
+ params.should eq({ foo: 'bar' })
30
33
  end
31
34
 
32
- it 'call should raise ArgumentError with invalid method' do
35
+ specify '#call should raise ArgumentError with invalid method' do
33
36
  expect { Fulcrum::Api.call(:foo) }.to raise_error(ArgumentError)
34
37
  end
35
38
 
36
- it 'call should not raise ArgumentError with valid method' do
39
+ specify '#call should not raise ArgumentError with valid method' do
37
40
  expect { Fulcrum::Api.call(:get) }.to_not raise_error(ArgumentError)
38
41
  end
39
42
  end
@@ -12,16 +12,12 @@ describe Fulcrum::Form do
12
12
  describe 'successful requests' do
13
13
  context '#all' do
14
14
  it 'should retrieve all records' do
15
- stub_request(:get, "#{Fulcrum::Api.configuration.uri}/forms.json").to_return(:status => 200, :body => '{"current_page":1,"total_pages":1,"total_count":1,"per_page":50,"forms":[]}')
15
+ records = {"current_page" => 1,"total_pages" => 1,"total_count" => 1,"per_page" => 50,"forms" => []}
16
+ stub_request(:get, "#{Fulcrum::Api.configuration.uri}/forms.json").to_return(:status => 200, :body => records.to_json)
16
17
  forms = Fulcrum::Form.all
17
18
  Fulcrum::Form.response.status.should eq(200)
18
19
  forms = JSON.parse(forms)
19
- forms.keys.should include('current_page')
20
- forms.keys.should include('total_pages')
21
- forms.keys.should include('total_count')
22
- forms.keys.should include('per_page')
23
- forms.keys.should include('forms')
24
- forms['forms'].should be_a(Array)
20
+ forms.should == records
25
21
  end
26
22
  end
27
23
 
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fulcrum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
5
- prerelease:
4
+ version: 0.1.6
6
5
  platform: ruby
7
6
  authors:
8
- - Chris Hall
7
+ - Spatial Networks
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-18 00:00:00.000000000 Z
11
+ date: 2014-04-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: webmock
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: debugger
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: activesupport
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ! '>='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ! '>='
92
81
  - !ruby/object:Gem::Version
@@ -94,23 +83,20 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: faraday
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - ~>
100
88
  - !ruby/object:Gem::Version
101
- version: '0'
89
+ version: 0.8.8
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - ~>
108
95
  - !ruby/object:Gem::Version
109
- version: '0'
96
+ version: 0.8.8
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: hashie
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
101
  - - ! '>='
116
102
  - !ruby/object:Gem::Version
@@ -118,7 +104,6 @@ dependencies:
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
108
  - - ! '>='
124
109
  - !ruby/object:Gem::Version
@@ -126,7 +111,6 @@ dependencies:
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: faraday_middleware
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
115
  - - ! '>='
132
116
  - !ruby/object:Gem::Version
@@ -134,14 +118,13 @@ dependencies:
134
118
  type: :runtime
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
122
  - - ! '>='
140
123
  - !ruby/object:Gem::Version
141
124
  version: '0'
142
- description: Fulcrum API Gem
125
+ description: Fulcrum API
143
126
  email:
144
- - chris@spatialnetworks.com
127
+ - sniadmin@spatialnetworks.com
145
128
  executables: []
146
129
  extensions: []
147
130
  extra_rdoc_files: []
@@ -185,28 +168,27 @@ files:
185
168
  - spec/spec_helper.rb
186
169
  homepage: http://github.com/spatialnetworks/fulcrum-ruby
187
170
  licenses: []
171
+ metadata: {}
188
172
  post_install_message:
189
173
  rdoc_options: []
190
174
  require_paths:
191
175
  - lib
192
176
  required_ruby_version: !ruby/object:Gem::Requirement
193
- none: false
194
177
  requirements:
195
178
  - - ! '>='
196
179
  - !ruby/object:Gem::Version
197
180
  version: '0'
198
181
  required_rubygems_version: !ruby/object:Gem::Requirement
199
- none: false
200
182
  requirements:
201
183
  - - ! '>='
202
184
  - !ruby/object:Gem::Version
203
185
  version: '0'
204
186
  requirements: []
205
187
  rubyforge_project:
206
- rubygems_version: 1.8.23
188
+ rubygems_version: 2.1.5
207
189
  signing_key:
208
- specification_version: 3
209
- summary: Fulcrum API Gem
190
+ specification_version: 4
191
+ summary: Fulcrum API
210
192
  test_files:
211
193
  - spec/data/form_data.json
212
194
  - spec/data/test.jpg
@@ -223,3 +205,4 @@ test_files:
223
205
  - spec/lib/validators/form_validator_spec.rb
224
206
  - spec/lib/validators/record_validator_spec.rb
225
207
  - spec/spec_helper.rb
208
+ has_rdoc: