Class: CardDB::Deck
Overview
Wrapper for hosted Deck objects
Instance Attribute Summary
Attributes inherited from Resource
#client, #data
Instance Method Summary
collapse
Methods inherited from Resource
#[], #initialize, #key?, #to_h, #to_json
Instance Method Details
#account_id ⇒ Object
773
774
775
|
# File 'lib/carddb/collection.rb', line 773
def account_id
data['accountId']
end
|
#api_application_id ⇒ Object
777
778
779
|
# File 'lib/carddb/collection.rb', line 777
def api_application_id
data['apiApplicationId']
end
|
#created_at ⇒ Object
841
842
843
|
# File 'lib/carddb/collection.rb', line 841
def created_at
parse_time(data['createdAt'])
end
|
#description ⇒ Object
801
802
803
|
# File 'lib/carddb/collection.rb', line 801
def description
data['description']
end
|
#entries ⇒ Object
825
826
827
|
# File 'lib/carddb/collection.rb', line 825
def entries
@entries ||= (data['entries'] || []).map { |entry| DeckEntry.new(entry, client: client) }
end
|
#external_ref ⇒ Object
813
814
815
|
# File 'lib/carddb/collection.rb', line 813
def external_ref
data['externalRef']
end
|
805
806
807
|
# File 'lib/carddb/collection.rb', line 805
def format_key
data['formatKey']
end
|
#game ⇒ Object
785
786
787
|
# File 'lib/carddb/collection.rb', line 785
def game
@game ||= data['game'] ? Game.new(data['game'], client: client) : nil
end
|
#game_id ⇒ Object
781
782
783
|
# File 'lib/carddb/collection.rb', line 781
def game_id
data['gameId']
end
|
#has_unpublished_changes? ⇒ Boolean
837
838
839
|
# File 'lib/carddb/collection.rb', line 837
def has_unpublished_changes?
!!data['hasUnpublishedChanges']
end
|
#id ⇒ Object
769
770
771
|
# File 'lib/carddb/collection.rb', line 769
def id
data['id']
end
|
#identifier ⇒ Object
793
794
795
|
# File 'lib/carddb/collection.rb', line 793
def identifier
data['identifier']
end
|
#latest_published_version ⇒ Object
829
830
831
|
# File 'lib/carddb/collection.rb', line 829
def latest_published_version
@latest_published_version ||= data['latestPublishedVersion'] ? DeckVersion.new(data['latestPublishedVersion'], client: client) : nil
end
|
821
822
823
|
# File 'lib/carddb/collection.rb', line 821
def metadata
data['metadata'] || {}
end
|
#published_at ⇒ Object
833
834
835
|
# File 'lib/carddb/collection.rb', line 833
def published_at
parse_time(data['publishedAt'])
end
|
#slug ⇒ Object
789
790
791
|
# File 'lib/carddb/collection.rb', line 789
def slug
data['slug']
end
|
#source_url ⇒ Object
817
818
819
|
# File 'lib/carddb/collection.rb', line 817
def source_url
data['sourceUrl']
end
|
#title ⇒ Object
797
798
799
|
# File 'lib/carddb/collection.rb', line 797
def title
data['title']
end
|
#updated_at ⇒ Object
845
846
847
|
# File 'lib/carddb/collection.rb', line 845
def updated_at
parse_time(data['updatedAt'])
end
|
#visibility ⇒ Object
809
810
811
|
# File 'lib/carddb/collection.rb', line 809
def visibility
data['visibility']
end
|