fetchapp-api-ruby 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v.2.0.1 New method "can_connect?" that
2
+
1
3
  v.2.0.0 ** API version 2.0 **
2
4
 
3
5
  v.1.2.5 Upload Support
data/README.md CHANGED
@@ -4,7 +4,9 @@
4
4
 
5
5
  # Setup
6
6
  ```ruby
7
- FetchAppAPI::Base.basic_auth('demokey', 'demotoken')
7
+ FetchAppAPI::Base.basic_auth(:key => 'demokey', :token => 'demotoken')
8
+ FetchAppAPI::Base.can_connect? # => true or false
9
+
8
10
  ```
9
11
  # Account
10
12
  ```ruby
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{fetchapp-api-ruby}
5
- s.version = "2.0.0"
5
+ s.version = "2.0.1"
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Michael Larkin"]
@@ -1,4 +1,3 @@
1
-
2
1
  # Extend the String class to have the handy .blank? method
3
2
  class String
4
3
  def blank?
@@ -38,6 +37,23 @@ module FetchAppAPI
38
37
  end
39
38
  end
40
39
 
40
+ # Determines whether or not we can connect to the API by
41
+ # calling the time method
42
+ def self.can_connect?
43
+ begin
44
+ result = execute(:get, "/time")["time"]
45
+ return !(result.empty? || result.nil?)
46
+ rescue
47
+ return false
48
+ end
49
+
50
+ end
51
+
52
+ # Returns the server time
53
+ def self.time
54
+ return execute(:get, "/time")["time"]
55
+ end
56
+
41
57
  class Connector #:nodoc:
42
58
  include HTTParty
43
59
  format :xml
@@ -95,7 +111,7 @@ module FetchAppAPI
95
111
  when 300.399 then
96
112
  raise("#{response.message}: #{response['message']}")
97
113
  when 400..499 then
98
- raise("#{response.message}: #{response['message']}")
114
+ raise("#{response.message}: #{response['message']}")
99
115
  when 500..599 then
100
116
  raise("#{response.message}: #{response['message']}")
101
117
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fetchapp-api-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-20 00:00:00.000000000 Z
12
+ date: 2013-05-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
16
- requirement: &70198023540320 !ruby/object:Gem::Requirement
16
+ requirement: &70104498954640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70198023540320
24
+ version_requirements: *70104498954640
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: fakeweb
27
- requirement: &70198023539340 !ruby/object:Gem::Requirement
27
+ requirement: &70104498953800 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70198023539340
35
+ version_requirements: *70104498953800
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mocha
38
- requirement: &70198023538340 !ruby/object:Gem::Requirement
38
+ requirement: &70104498952840 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70198023538340
46
+ version_requirements: *70104498952840
47
47
  description: Integrate your site with http://fetchapp.com for seamless digital delivery.
48
48
  email: support@fetchapp.com
49
49
  executables: []