Class: Android::Publisher::Connection
- Inherits:
-
Object
- Object
- Android::Publisher::Connection
- Defined in:
- lib/android/publisher/connection.rb
Constant Summary collapse
- API_URL =
URI.parse('https://www.googleapis.com/androidpublisher/v2/applications/')
- UPLOAD_URL =
URI.parse('https://www.googleapis.com/upload/androidpublisher/v2/applications/')
Instance Method Summary collapse
- #add_endpoint(endpoint) ⇒ Object
- #delete(path = "") ⇒ Object
- #get(path = "") ⇒ Object
-
#initialize(authorized_connection, package_name, endpoints = []) ⇒ Connection
constructor
A new instance of Connection.
- #just_post(path = "", params = {}) ⇒ Object
- #patch(path = "", params = {}) ⇒ Object
- #post(path = "", params = {}) ⇒ Object
- #put(params = {}) ⇒ Object
- #remove_endpoint ⇒ Object
- #upload(file) ⇒ Object
Constructor Details
#initialize(authorized_connection, package_name, endpoints = []) ⇒ Connection
Returns a new instance of Connection.
11 12 13 14 15 |
# File 'lib/android/publisher/connection.rb', line 11 def initialize(, package_name, endpoints = []) @authorized_connection = @package_name = package_name @endpoints = endpoints end |
Instance Method Details
#add_endpoint(endpoint) ⇒ Object
17 18 19 |
# File 'lib/android/publisher/connection.rb', line 17 def add_endpoint(endpoint) Connection.new(,package_name, [*@endpoints, endpoint]) end |
#delete(path = "") ⇒ Object
43 44 45 |
# File 'lib/android/publisher/connection.rb', line 43 def delete(path = "") .delete(append(path)) end |
#get(path = "") ⇒ Object
29 30 31 |
# File 'lib/android/publisher/connection.rb', line 29 def get(path = "") .get(append(path)) end |
#just_post(path = "", params = {}) ⇒ Object
33 34 35 |
# File 'lib/android/publisher/connection.rb', line 33 def just_post(path = "", params = {}) .post(URI.join(API_URL, "#{package_name}/", path), params) end |
#patch(path = "", params = {}) ⇒ Object
47 48 49 |
# File 'lib/android/publisher/connection.rb', line 47 def patch(path = "", params = {}) .patch(append(path), params) end |
#post(path = "", params = {}) ⇒ Object
37 38 39 |
# File 'lib/android/publisher/connection.rb', line 37 def post(path = "", params = {}) .post(append(path), params) end |
#put(params = {}) ⇒ Object
25 26 27 |
# File 'lib/android/publisher/connection.rb', line 25 def put(params = {}) .put(append(""), params) end |
#remove_endpoint ⇒ Object
21 22 23 |
# File 'lib/android/publisher/connection.rb', line 21 def remove_endpoint Connection.new(,package_name, @endpoints[0..-2]) end |
#upload(file) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/android/publisher/connection.rb', line 51 def upload(file) params = { :headers => { 'Content-Type' => 'application/octet-stream', 'Content-Length'=> file.size.to_s }, :body => Faraday::UploadIO.new(file.path, 'application/octet-stream') } .post(upload_uri, params) end |