basecampeverest 0.1.1.1 → 0.1.2.6

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: 70726638b40f614cee73986a839aa976a437dc30
4
- data.tar.gz: 9c708f37e0f7ebbc7f2afcbccdf0a2fd278c29c5
3
+ metadata.gz: cd0cb31fd2aab4b67afe699d87775e5fea8a3364
4
+ data.tar.gz: ca95351fd89befad125053be3e359f277f8ed01f
5
5
  SHA512:
6
- metadata.gz: 35f1c11eaf6f9a57216a344974a5277003b3f3ed7915c59f59946fc06a3619b05d0d9968def3c31802fc81d3d7fa66aafb1fbaeb295c606896b7e09483e87328
7
- data.tar.gz: 17e6c8d93bac275d151e792f47b02e67891a253cde487e1731e9b1937a13a32cb9f5408d1fda8f9c1bb3eddea31adca28cc291da4c29e78203d9ba2ee6425f4c
6
+ metadata.gz: b07638a54d490a8e0f1c0abcdb2658aa2a6747937a96c145c69f30a1ea72b92aaab70389b40dd43940c573b6367e88dc78b675270bdc238d2ad6a819779ca62f
7
+ data.tar.gz: 432d289eef043a41935a6d975804608ba36fc0c427a184c2cb27da1e37af49cdf57e4df9a75fec8986fae651d270c2743e32cb2649fa0cda59ea158369e1a028
@@ -89,22 +89,29 @@ module Basecampeverest
89
89
  # nice and pretty now
90
90
  authorization = clensed_auth_hash
91
91
 
92
- # if the authorization has the correct hash values...
93
- if authorization.has_key?(:username) && authorization.has_key?(:password)
92
+ if auth_hash.has_key? :access_token
93
+ # clear the basic_auth, if it's set
94
+ self.class.default_options.reject!{ |k| k == :basic_auth }
95
+
96
+ # set the Authorization headers
97
+ self.class.headers.merge!("Authorization" => "Bearer #{auth_hash[:access_token]}")
94
98
 
95
- # ... then we pass it off to basic auth
96
- self.class.basic_auth authorization[:username], authorization[:password]
97
-
98
- # check if the user tried passing in some other stupid stuff.
99
- # this should never be the case if the user follows instructions.
100
- self.class.headers.reject!{ |k, v| k == "Authorization" }
99
+ elsif authorization.has_key?(:username) && authorization.has_key?(:password)
101
100
 
102
- else
103
- # something inportant is missing if we get here.
104
- raise "Incomplete Authorization hash. Please check the Authentication Hash."
101
+ # ... then we pass it off to basic auth
102
+ self.class.basic_auth authorization[:username], authorization[:password]
103
+
104
+ # check if the user tried passing in some other stupid stuff.
105
+ # this should never be the case if the user follows instructions.
106
+ self.class.headers.reject!{ |k, v| k == "Authorization" }
107
+
108
+ else
109
+ # something inportant is missing if we get here.
110
+ raise "Incomplete Authorization hash. Please check the Authentication Hash."
111
+
112
+ #end else
113
+ end
105
114
 
106
- #end else
107
- end
108
115
 
109
116
  # end method
110
117
  end
@@ -13,11 +13,42 @@ module Basecampeverest; class CalendarEvents
13
13
 
14
14
  # #### via the Basecamp API
15
15
  #
16
+ # @param [Basecampeverest::Project] project_id
17
+ # @return [Basecampeverest::Project] #### from the Basecamp API
18
+ def self.find(project_id)
19
+ url = "/projects/#{project_id}/calendar_events.json"
20
+ response = Basecampeverest::Connect.get url
21
+ # parse the response to remove HTTParty info
22
+ response.parsed_response
23
+ end
24
+
25
+ # #### via the Basecamp API
26
+ #
27
+ # @param [Basecampeverest::Project] project_id
28
+ # @param [Basecampeverest::Project] project_id
29
+ # @return [Basecampeverest::Project] #### from the Basecamp API
30
+ def self.find_specific(project_id, event_id)
31
+ url = "/projects/#{project_id}/calendar_events/#{event_id}.json"
32
+ response = Basecampeverest::Connect.get url
33
+
34
+ # parse the response to remove HTTParty info
35
+ response.parsed_response
36
+ end
37
+
38
+ # #### via the Basecamp API
39
+ #
40
+ #
41
+ # @param [Basecampeverest::Project] ####
16
42
  # @param [Basecampeverest::Project] ####
17
43
  # @return [Basecampeverest::Project] #### from the Basecamp API
18
- def self.find()
19
- url =
20
- response = Basecampeverest::Connect.get
44
+ def self.new_project_event(project_id, options={})
45
+ post_params = {
46
+ :body => options.to_json,
47
+ :headers => Basecampeverest::Connect.headers.merge({'Content-Type' => 'application/json'})
48
+ }
49
+ # make the http basecamp call
50
+ url = "/projects/#{project_id}/calendar_events.json"
51
+ response = Basecampeverest::Connect.post url, post_params
21
52
 
22
53
  # parse the response to remove HTTParty info
23
54
  response.parsed_response
@@ -29,19 +60,21 @@ module Basecampeverest; class CalendarEvents
29
60
  # @param [Basecampeverest::Project] ####
30
61
  # @param [Basecampeverest::Project] ####
31
62
  # @return [Basecampeverest::Project] #### from the Basecamp API
32
- def self.new(options={})
63
+ def self.new_calendar_event(options={})
33
64
  post_params = {
34
65
  :body => options.to_json,
35
66
  :headers => Basecampeverest::Connect.headers.merge({'Content-Type' => 'application/json'})
36
67
  }
37
68
  # make the http basecamp call
38
- url = "####"
69
+ url = "/projects/1/calendar_events.json"
39
70
  response = Basecampeverest::Connect.post url, post_params
40
71
 
41
72
  # parse the response to remove HTTParty info
42
73
  response.parsed_response
43
74
  end
44
75
 
76
+
77
+
45
78
  # #### via the Basecamp API
46
79
  #
47
80
  # @param [Basecampeverest::Project] ####
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: basecampeverest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.1
4
+ version: 0.1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Gordon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-10 00:00:00.000000000 Z
11
+ date: 2014-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty