geotrigger 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: 4884037658b1d1060d37d2d134905b6e2b4ee48b
4
- data.tar.gz: 1f237b42ce60c8ed9ca3df6a5cb6c90540363554
3
+ metadata.gz: 1eab33595fb526ab1fd3bd9b5ce817efec4645d4
4
+ data.tar.gz: 2d130461adf416f37c4a4bc4ae2244f663d09339
5
5
  SHA512:
6
- metadata.gz: a50e202502a0e43566451f2525fda48a8b574537eefe074c2d8503e5493ac75193712f435e9c97ad9cc368e7580ad58720e8969d67b2b0f5b29eb1de4e680e7f
7
- data.tar.gz: 6080147b5dfcc3f8a73b2ead823a0d0a04dc81316f04b783dc32f78fec39b07d6041696b682d7f682060b69de26be5a88c74fde44253bebe6309777f8aeaca11
6
+ metadata.gz: f5f6c4e88f34f686f28b1954f9dce23aa692fdabeae8dae54ee99c1f27897f5545da557a0405f600622ba9b4a4f966d49111a531620485540f79860c38ec98f9
7
+ data.tar.gz: 4f87a58f91f31f10a23636b452e1210b4a90945e0e7e65f68ce224a2f9347d22f0d9008eb51a09f7e3fcb5c09e5c32e4fcb78437988a434894bb478e9c27021f
@@ -8,9 +8,25 @@ module Geotrigger
8
8
  (ENV['GT_BASE_URL'] + '%s') :
9
9
  'https://geotrigger.arcgis.com/%s').freeze
10
10
 
11
+ USER_CONFIG = File.join ENV['HOME'], '.geotrigger'
12
+
11
13
  attr_writer :access_token
12
14
 
13
15
  def initialize opts = {}
16
+ if opts[:config] or opts.empty?
17
+ if File.exist? USER_CONFIG
18
+ require 'yaml'
19
+ _opts = YAML.load_file USER_CONFIG
20
+ _opts = _opts[opts[:config]] if opts[:config]
21
+ while _opts[:client_id].nil? do
22
+ _opts_keys ||= _opts.keys
23
+ k = _opts_keys.shift
24
+ raise if k.nil?
25
+ _opts = _opts[k]
26
+ end
27
+ opts = _opts
28
+ end
29
+ end
14
30
  @ago = AGO::Session.new opts
15
31
  @hc = HTTPClient.new
16
32
  end
@@ -5,6 +5,7 @@ module Geotrigger
5
5
  def self.create session, opts
6
6
  t = ::Geotrigger::Tag.new session: session
7
7
  t.data = opts
8
+ t.data[:tags] = t.data.delete :name if t.data[:name]
8
9
  t.post_create
9
10
  end
10
11
 
@@ -25,7 +26,7 @@ module Geotrigger
25
26
 
26
27
  def post_create
27
28
  post_data = @data.dup
28
- grok_self_from post('tag/permissions', post_data), @data[:tags]
29
+ grok_self_from post('tag/permissions/update', post_data), @data[:tags]
29
30
  self
30
31
  end
31
32
 
@@ -33,7 +34,7 @@ module Geotrigger
33
34
  raise StateError.new 'device access_token prohibited' if @session.device?
34
35
  post_data = @data.dup
35
36
  post_data['tags'] = post_data.delete 'name'
36
- grok_self_from post 'tag/permissions', post_data
37
+ grok_self_from post 'tag/permissions/update', post_data
37
38
  self
38
39
  end
39
40
  alias_method :save, :post_update
@@ -1,3 +1,3 @@
1
1
  module Geotrigger
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -101,7 +101,7 @@ describe Geotrigger::Session do
101
101
  end
102
102
 
103
103
  it 'raises errors correctly' do
104
- s = Geotrigger::Session.new
104
+ s = Geotrigger::Session.new client_id: 'foo', client_secret: 'bar'
105
105
  ->{ s.post 'application/permissions' }.should raise_error
106
106
  end
107
107
 
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geotrigger
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
  - Kenichi Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-08 00:00:00.000000000 Z
11
+ date: 2014-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: timecop
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
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'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
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
68
  version: '0'
69
69
  description: A small ruby client for Esri's Geotrigger service
@@ -73,7 +73,7 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - ".gitignore"
76
+ - .gitignore
77
77
  - Gemfile
78
78
  - README.md
79
79
  - geotrigger.gemspec
@@ -104,17 +104,17 @@ require_paths:
104
104
  - lib
105
105
  required_ruby_version: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - ">="
107
+ - - '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  requirements:
112
- - - ">="
112
+ - - '>='
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
115
  requirements: []
116
116
  rubyforge_project:
117
- rubygems_version: 2.2.0
117
+ rubygems_version: 2.0.14
118
118
  signing_key:
119
119
  specification_version: 4
120
120
  summary: A small ruby client for Esri's Geotrigger service