fanforce-api 0.8.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmEwYTE4NmVlMTVlZWNlNGM1MTliMTY4NjQwNjlhM2EyMDRjMzg3Mg==
4
+ NWJmMmYxYjk3ZjlkNDZkZDM4NTA5ZWJmZDk0YmE0OWIyZmNhOTQ3Yw==
5
5
  data.tar.gz: !binary |-
6
- MjZlMGQ0ZjRhOTZkYTI5M2UyNjY5YjNiNTVkZTc3NWRhYzRhMmUyZg==
6
+ MjIxYmQxM2FlMjFjMDYwZDkwZmZiNzZjNDY0MTAxNWJkYzMyOWJhYg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NTJjNGE1M2E3ZGFmMjI3NGY2OTVmNDM4NmYyNThmNGI1OWFmNTBlNzQ5MzQ2
10
- MDk0NjVmYTdlYzJmNjlhYjdmZmI2YTg3NGFhMGNiNTY5MzYxMTBkOTEyOTQy
11
- MzFmMjQyNmVhNzViMzc1NmRkYzlhNTllNzU4MWYzMmEzNDA0NDc=
9
+ ZjgxODVmOTMzZWVkNWUxOTlkMjZmYTUxMzY0NDI2MmFhYzdiNTVmYjgyY2Ix
10
+ YTBkNDdmNmNiMGI0ODA3NmFkZWI5YmFkMjM0NzlhNmMyYjIzODQ4NDk3ODk3
11
+ ZDY4NTQyMmM0MWU4YzVmZTljNmNmMTE1YmI2ZjQxMGI5Mjk4ODc=
12
12
  data.tar.gz: !binary |-
13
- MTZhNzczYTgwMjdmNDcxYWI2ZWE0YTA1MGIxNTMzM2Y3ZDYzY2Y1MTRmMGI5
14
- MjQ0MjM1MDE0OWQyNjhiNTY2ZjVmYzRmZGY1NjNjNjdiYThiOTQyYTRlYjE2
15
- MDI3ODI0Y2RhMTYzYjljMDE2MTNhODM0ZTVjOWQ5ZWM2ZWNmYjQ=
13
+ MDBmYWY4YzBiNDY1M2RiY2NkN2ExNmU1ZGY3OWVhOTljNTA3ODY2NGE4ODBl
14
+ N2EwYjFlYjI3OGE3YTQ2ZGJkNmZiMDgxZjE3OWMwY2I0YmM1NzQ2NmIzNzA5
15
+ NzkwMmU0ZDdhMDZiNWRkNDg2YmFiMjMwMzA3NmFjZDM0MWI2ODI=
data/fanforce-api.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'fanforce/api/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = 'fanforce-api'
8
- gem.version = Fanforce::Api::VERSION
8
+ gem.version = Fanforce::API::VERSION
9
9
  gem.date = '2012-10-19'
10
10
  gem.summary = %q{Ruby API wrapper for Fanforce}
11
11
  gem.description = %q{Ruby API wrapper that interfaces with all six Fanforce APIs.}
data/lib/fanforce.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require './fanforce/api'
2
- class Fanforce < Fanforce::Api
3
- # ToDo: remove Fanforce::Api from inheritance. Fanforce should be a bare class.
2
+ class Fanforce < Fanforce::API
3
+ # ToDo: remove Fanforce::API from inheritance. Fanforce should be a bare class.
4
4
  end
5
5
 
data/lib/fanforce/api.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  class Fanforce
2
2
  require 'fanforce/errors'
3
3
 
4
- class Api
4
+ class API
5
5
  require_relative 'api/_main'
6
6
  require_relative 'api/version'
7
7
  require_relative 'api/ff_globals'
@@ -2,8 +2,8 @@ require 'rest-client'
2
2
  require_relative 'utils'
3
3
  require_relative 'response'
4
4
 
5
- class Fanforce::Api
6
- include Fanforce::Api::Utils
5
+ class Fanforce::API
6
+ include Fanforce::API::Utils
7
7
  include Fanforce::Errors
8
8
 
9
9
  def initialize(arg={})
@@ -36,7 +36,7 @@ class Fanforce::Api
36
36
  def get(path, req_params={})
37
37
  req_params = apply_auth(req_params)
38
38
  RestClient.get(url(path, req_params), :accept => :json) do |response, request, result, &block|
39
- Fanforce::Api::Response.process(response, request, complete_url(path), req_params)
39
+ Fanforce::API::Response.process(response, request, complete_url(path), req_params)
40
40
  end
41
41
  end
42
42
 
@@ -44,7 +44,7 @@ class Fanforce::Api
44
44
  url = complete_url(path)
45
45
  req_params = apply_auth(req_params)
46
46
  RestClient.post(url, req_params.to_json, :content_type => :json, :accept => :json) do |response, request, result, &block|
47
- Fanforce::Api::Response.process(response, request, url, req_params)
47
+ Fanforce::API::Response.process(response, request, url, req_params)
48
48
  end
49
49
  end
50
50
 
@@ -52,7 +52,7 @@ class Fanforce::Api
52
52
  url = complete_url(path)
53
53
  req_params = apply_auth(req_params)
54
54
  RestClient.put(url, req_params.to_json, :content_type => :json, :accept => :json) do |response, request, result, &block|
55
- Fanforce::Api::Response.process(response, request, url, req_params)
55
+ Fanforce::API::Response.process(response, request, url, req_params)
56
56
  end
57
57
  end
58
58
 
@@ -60,7 +60,7 @@ class Fanforce::Api
60
60
  url = complete_url(path)
61
61
  req_params = apply_auth(req_params)
62
62
  RestClient.delete(url(path, req_params), :accept => :json) do |response, request, result, &block|
63
- Fanforce::Api::Response.process(response, request, url, req_params)
63
+ Fanforce::API::Response.process(response, request, url, req_params)
64
64
  end
65
65
  end
66
66
 
@@ -1,6 +1,6 @@
1
1
  require_relative 'utils'
2
2
 
3
- class Fanforce::Api::Error < StandardError
3
+ class Fanforce::API::Error < StandardError
4
4
  attr_accessor :response, :request, :requested_url, :requested_params, :errors
5
5
 
6
6
  def initialize(message, response, request, requested_url, requested_params)
@@ -22,7 +22,7 @@ class Fanforce::Api::Error < StandardError
22
22
  def to_hash; {} end
23
23
  end
24
24
 
25
- class Fanforce::Api::ServerError < Fanforce::Api::Error
25
+ class Fanforce::API::ServerError < Fanforce::API::Error
26
26
 
27
27
  def initialize(response, request, requested_url, requested_params)
28
28
  @response_body = response.to_s
@@ -31,7 +31,7 @@ class Fanforce::Api::ServerError < Fanforce::Api::Error
31
31
  @response_hash = Fanforce::Utils.decode_json(response)
32
32
  @errors = @response_hash[:errors]
33
33
  rescue Exception => e
34
- raise Fanforce::Api::DecodingError.new(e, response, request, requested_url, requested_params)
34
+ raise Fanforce::API::DecodingError.new(e, response, request, requested_url, requested_params)
35
35
  end
36
36
 
37
37
  super(response.to_s, response, request, requested_url, requested_params)
@@ -50,7 +50,7 @@ class Fanforce::Api::ServerError < Fanforce::Api::Error
50
50
 
51
51
  end
52
52
 
53
- class Fanforce::Api::DecodingError < Fanforce::Api::Error
53
+ class Fanforce::API::DecodingError < Fanforce::API::Error
54
54
 
55
55
  def initialize(e, response, request, requested_url, requested_params)
56
56
  @message = "There was a Fanforce gem error while decoding JSON response: #{e.message}"
@@ -1,20 +1,20 @@
1
- class Fanforce::Api::Response
1
+ class Fanforce::API::Response
2
2
  attr_reader :curl_command, :requested_url, :requested_params
3
3
 
4
4
  def self.process(response, request, requested_url, requested_params)
5
- raise Fanforce::Api::ServerError.new(response, request, requested_url, requested_params) if response.code > 201
5
+ raise Fanforce::API::ServerError.new(response, request, requested_url, requested_params) if response.code > 201
6
6
  begin response_hash = Fanforce::Utils.decode_json(response)
7
- rescue Exception => e; raise Fanforce::Api::DecodingError.new(e, response, request, requested_url, requested_params) end
7
+ rescue Exception => e; raise Fanforce::API::DecodingError.new(e, response, request, requested_url, requested_params) end
8
8
  if response_hash[:results]
9
- Fanforce::Api::Results.new(response_hash, response, request, requested_url, requested_params)
9
+ Fanforce::API::Results.new(response_hash, response, request, requested_url, requested_params)
10
10
  else
11
- Fanforce::Api::Result.new(response_hash, response, request, requested_url, requested_params)
11
+ Fanforce::API::Result.new(response_hash, response, request, requested_url, requested_params)
12
12
  end
13
13
  end
14
14
 
15
15
  end
16
16
 
17
- class Fanforce::Api::Result < Hash
17
+ class Fanforce::API::Result < Hash
18
18
  attr_reader :requested_url, :requested_params
19
19
 
20
20
  def initialize(response_hash, response, request, requested_url, requested_params)
@@ -50,7 +50,7 @@ class Fanforce::Api::Result < Hash
50
50
  def code; @response.code end
51
51
  end
52
52
 
53
- class Fanforce::Api::Results < Array
53
+ class Fanforce::API::Results < Array
54
54
  attr_reader :requested_url, :requested_params
55
55
 
56
56
  def initialize(response_hash, response, request, requested_url, requested_params)
@@ -1,8 +1,8 @@
1
1
  require 'fanforce/utils'
2
2
 
3
- module Fanforce::Api::Utils
3
+ module Fanforce::API::Utils
4
4
  include Fanforce::Utils
5
- extend Fanforce::Api::Utils
5
+ extend Fanforce::API::Utils
6
6
  def self.included(base) base.extend(self) end
7
7
 
8
8
  def valid_fanforce_js_request?(params=@params)
@@ -1,5 +1,5 @@
1
1
  class Fanforce
2
- class Api
3
- VERSION = '0.8.2'
2
+ class API
3
+ VERSION = '0.9.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fanforce-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Clark