add_this 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,14 @@
2
2
  #
3
3
  # builds a base class for all the api calls
4
4
  # to inherit from.
5
+ #
6
+ # @example
7
+ # add_this = AddThis::Client.new
8
+ # add_this.shares_url
9
+ #
10
+ # @example
11
+ # AddThis.get.shares_url
12
+ #
5
13
 
6
14
  require "add_this/requests"
7
15
 
@@ -56,9 +64,11 @@ module AddThis
56
64
  end
57
65
 
58
66
  class << self
67
+ # attrs for storing the client object
59
68
  attr_accessor :client
60
69
  end
61
70
 
71
+ # defining the client object so you can make requests on the AddThis class
62
72
  def self.get
63
73
  self.client ||= Client.new
64
74
  end
@@ -1,16 +1,30 @@
1
+ # Request module
2
+ #
3
+ # gets included in the client this is were all the actual api calls are created
4
+
1
5
  module AddThis
2
6
 
3
7
  module Requests
4
-
8
+
9
+ # requests method
10
+ #
11
+ # Defines the get request for all the methods by splitting the method name
12
+ # and the underscore to keep things dry as well allows your to pass a hash
13
+ # for all the query params
14
+ #
15
+ # @option args [Array] all of the symbolized method names
5
16
  def self.requests(*args)
6
17
  args.each do |arg|
7
18
  define_method arg do |*options|
8
19
  metric, dimension = arg.to_s.split("_")
9
- connection.get("/analytics/1.0/pub/shares/url.json", options[0]).body
20
+ connection.get("/analytics/1.0/pub/#{metric}/#{dimension}.json", options[0]).body
10
21
  end
11
22
  end
12
23
  end
13
-
24
+
25
+ # Requests
26
+ #
27
+ # All availble methods that will hit the api
14
28
  requests :shares_day, :shares_url, :shares_domain, :shares_service,
15
29
  :shares_interest, :shares_continent, :shares_country, :clicks_day,
16
30
  :clicks_url, :clicks_domain, :clicks_service, :clicks_interest,
@@ -1,3 +1,3 @@
1
1
  module AddThis
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: add_this
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -15,7 +15,7 @@ date: 2012-02-16 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday
18
- requirement: &70284673873900 !ruby/object:Gem::Requirement
18
+ requirement: &70175978315520 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: '0'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70284673873900
26
+ version_requirements: *70175978315520
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday_middleware
29
- requirement: &70284673873140 !ruby/object:Gem::Requirement
29
+ requirement: &70175978314760 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: '0'
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *70284673873140
37
+ version_requirements: *70175978314760
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: hashie
40
- requirement: &70284673871800 !ruby/object:Gem::Requirement
40
+ requirement: &70175978313860 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: '0'
46
46
  type: :runtime
47
47
  prerelease: false
48
- version_requirements: *70284673871800
48
+ version_requirements: *70175978313860
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: rspec
51
- requirement: &70284673870500 !ruby/object:Gem::Requirement
51
+ requirement: &70175978313260 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: '0'
57
57
  type: :development
58
58
  prerelease: false
59
- version_requirements: *70284673870500
59
+ version_requirements: *70175978313260
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: guard
62
- requirement: &70284673869820 !ruby/object:Gem::Requirement
62
+ requirement: &70175978312720 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ! '>='
@@ -67,10 +67,10 @@ dependencies:
67
67
  version: '0'
68
68
  type: :development
69
69
  prerelease: false
70
- version_requirements: *70284673869820
70
+ version_requirements: *70175978312720
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: guard-rspec
73
- requirement: &70284673869020 !ruby/object:Gem::Requirement
73
+ requirement: &70175978312160 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - ! '>='
@@ -78,7 +78,7 @@ dependencies:
78
78
  version: '0'
79
79
  type: :development
80
80
  prerelease: false
81
- version_requirements: *70284673869020
81
+ version_requirements: *70175978312160
82
82
  description: Simple API connector for getting analytic data from AddThis
83
83
  email:
84
84
  - chris@generalthings.com