Class: Eventbrite::Client
- Inherits:
-
Object
- Object
- Eventbrite::Client
- Defined in:
- lib/eventbrite.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Client
constructor
A new instance of Client.
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/eventbrite.rb', line 10 def initialize(*args) = args. @authentication = @conn = Faraday.new(:url => "http://www.eventbrite.com") do |builder| builder.adapter Faraday.default_adapter builder.use Faraday::Response::Logger #if options[:debug] == true builder.use Faraday::Response::Mashify builder.use Faraday::Response::ParseJson end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/eventbrite.rb', line 21 def method_missing(name, *args, &block) puts "method missing: #{name}" = args. .merge! @authentication response = conn.get("/json/#{name.to_s}") { |req| req.params = } if response.body[:error] puts response.body[:error] end response.body[response.body.keys.first] end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/eventbrite.rb', line 8 def api_key @api_key end |
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
8 9 10 |
# File 'lib/eventbrite.rb', line 8 def conn @conn end |