Class: GrowViral::Keystore::ApplicationFetcher
- Inherits:
-
Object
- Object
- GrowViral::Keystore::ApplicationFetcher
- Defined in:
- lib/keystore/application_fetcher.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
Class Method Summary collapse
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(provider, name, deps) ⇒ ApplicationFetcher
constructor
A new instance of ApplicationFetcher.
- #uri ⇒ Object
Constructor Details
#initialize(provider, name, deps) ⇒ ApplicationFetcher
Returns a new instance of ApplicationFetcher.
9 10 11 12 13 |
# File 'lib/keystore/application_fetcher.rb', line 9 def initialize(provider, name, deps) @provider = provider @name = name @config = deps[:config] end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/keystore/application_fetcher.rb', line 8 def config @config end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/keystore/application_fetcher.rb', line 8 def name @name end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
8 9 10 |
# File 'lib/keystore/application_fetcher.rb', line 8 def provider @provider end |
Class Method Details
.fetch(*args) ⇒ Object
4 5 6 |
# File 'lib/keystore/application_fetcher.rb', line 4 def self.fetch(*args) new(*args).fetch end |
Instance Method Details
#fetch ⇒ Object
15 16 17 18 |
# File 'lib/keystore/application_fetcher.rb', line 15 def fetch response = Net::HTTP.get_response(uri) Application.new JSON.parse(response.body) end |
#uri ⇒ Object
20 21 22 |
# File 'lib/keystore/application_fetcher.rb', line 20 def uri @uri ||= URI.parse("#{config.host}/applications/#{name}?provider=#{provider}") end |