lib/marver.rb in marver-0.0.0 vs lib/marver.rb in marver-0.0.2
- old
+ new
@@ -1,28 +1,42 @@
require 'rest_client'
-require 'digest/md5'
-class Marver
- API_VERSION = "v1"
- API_ENDPOINT = "http://gateway.marvel.com"
+# Base Classes
+require './lib/marver/client.rb'
+require './lib/marver/version.rb'
+require './lib/marver/credentials.rb'
+require './lib/marver/data_container.rb'
- attr_reader :private_key, :public_key
+# Finders
+require './lib/marver/finders/character_finder.rb'
- def initialize(private_key, public_key)
- @private_key = private_key
- @public_key = public_key
- end
+# REST
+require './lib/marver/rest/client.rb'
+require './lib/marver/rest/response.rb'
- def characters(name = "")
- endpoint = build_url("characters")
- endpoint = endpoint + "&name=#{name}" unless name.empty?
- response = RestClient.get endpoint
- end
+# Helpers & builders
+require './lib/marver/helpers/string_helper.rb'
+require './lib/marver/builders/core_entities_builder.rb'
+require './lib/marver/builders/common_entities_builder.rb'
- private
+# Common Entities
+require './lib/marver/entities/common/text_object.rb'
+require './lib/marver/entities/common/image.rb'
+require './lib/marver/entities/common/url.rb'
+require './lib/marver/entities/common/key_date.rb'
+require './lib/marver/entities/common/price.rb'
- def build_url(noun)
- ts = Time.now.to_i.to_s
- hash = Digest::MD5.hexdigest(ts + private_key + public_key)
- "#{API_ENDPOINT}/#{API_VERSION}/public/#{noun}?ts=#{ts}&apikey=#{public_key}&hash=#{hash}"
- end
-end
+# Core Entities
+require './lib/marver/entities/core/event.rb'
+require './lib/marver/entities/core/serie.rb'
+require './lib/marver/entities/core/story.rb'
+require './lib/marver/entities/core/character.rb'
+require './lib/marver/entities/core/creator.rb'
+require './lib/marver/entities/core/comic.rb'
+
+# Summary Entities
+require './lib/marver/entities/summaries/character_summary.rb'
+require './lib/marver/entities/summaries/comic_summary.rb'
+require './lib/marver/entities/summaries/story_summary.rb'
+require './lib/marver/entities/summaries/event_summary.rb'
+require './lib/marver/entities/summaries/serie_summary.rb'
+require './lib/marver/entities/summaries/creator_summary.rb'