driftrock-service 0.4.12 → 0.4.13

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.
@@ -9,7 +9,7 @@ module Driftrock
9
9
  end
10
10
 
11
11
  def post_to_api(url, user_id, company_id, data)
12
- response = HTTParty.post(build_url_for_driftrock(url),
12
+ response = HTTParty.post(build_url_for_driftrock(url), timeout: 180,
13
13
  :body => body_for(user_id, company_id, data))
14
14
  debug_request(url, user_id, company_id, data, response)
15
15
  response
@@ -35,6 +35,16 @@ module Driftrock::Service::DriftrockModel
35
35
  new(object_hash)
36
36
  end
37
37
 
38
+ def method_missing(method_sym, *args, &block)
39
+ if method_sym =~ /^find_by_.+$/
40
+ type = method_sym.to_s.gsub(/^find_by_/, '')
41
+ object_hash = get_from_api_method.call("/#{type}/#{args.first}")
42
+ new(object_hash)
43
+ else
44
+ super
45
+ end
46
+ end
47
+
38
48
  def all
39
49
  object_arr = get_from_api_method.call("/")
40
50
  object_arr.map do |object_hash|
@@ -58,12 +58,7 @@ module Driftrock::Service::DriftrockModel
58
58
  end
59
59
  status
60
60
  end
61
-
62
- def self.find_by_app_id(app_id)
63
- object_hash = get_from_api_method.call("/#{app_id}/by_app_id")
64
- new(object_hash)
65
- end
66
-
61
+
67
62
  def self.all_for_current_user
68
63
  array_of_app_hashes = get_from_api_method.call("/apps_for_current_user")
69
64
  array_of_app_hashes.map do |app_hash|
@@ -1,5 +1,5 @@
1
1
  module Driftrock
2
2
  module Service
3
- VERSION = "0.4.12"
3
+ VERSION = "0.4.13"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: driftrock-service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.12
4
+ version: 0.4.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-21 00:00:00.000000000 Z
12
+ date: 2013-07-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -70,7 +70,6 @@ files:
70
70
  - lib/driftrock-service/driftrock_logger.rb
71
71
  - lib/driftrock-service/driftrock_model.rb
72
72
  - lib/driftrock-service/driftrock_model/admin/driftrock_app.rb
73
- - lib/driftrock-service/driftrock_model/admin/driftrock_company.rb
74
73
  - lib/driftrock-service/driftrock_model/admin/driftrock_user.rb
75
74
  - lib/driftrock-service/driftrock_model/channel.rb
76
75
  - lib/driftrock-service/driftrock_model/channel_type.rb
@@ -107,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
106
  version: '0'
108
107
  requirements: []
109
108
  rubyforge_project:
110
- rubygems_version: 1.8.24
109
+ rubygems_version: 1.8.25
111
110
  signing_key:
112
111
  specification_version: 3
113
112
  summary: Maintains the api endpoints and the calls to them with authorisation, etc.
@@ -1,10 +0,0 @@
1
- module Driftrock
2
- module Admin
3
- module DriftrockModel
4
- class DriftrockCompany
5
- include ::Driftrock::Service::DriftrockModel
6
- set_api_path "/admin/companies"
7
- end
8
- end
9
- end
10
- end